PerlDancer / PerlDancer/Dancer2

"Finally, correct UTF-8 and charset handling" (e9d01967ac) broke ordered json

Open
#1,793 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Perl
Stars
604
Forks
288
Avg merge
1d 5h
Merged PRs (30d)
5

Description

We have some cases where it weirdly enough is required to return a json structure with keys in a certain order.

For that we've used Tie::IxHash and that has before gotten passed all the way down through Dancer and into JSON::MaybeXS and it all has worked well.

In "Finally, correct UTF-8 and charset handling" (e9d01967ac) , the hash is rewritten in _ensure_characters which turns it from our Tie::IxHash into a normal unordered hash, which breaks our ordering.

It would be nice if we could still return our super special ordered json without needing to do ugly hacking on Dancer.

If that's not the case, we'll look into writing our own Serializer for those resources.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating _ensure_characters and tracing how Tie::IxHash values move into JSON::MaybeXS. Preserve ordered keys through that handling, then verify that resources can still return JSON in the requested order without Dancer-specific workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
perl
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.