in reply to Re: Preserve the order in JSON
in thread Preserve the order in JSON

I have a reason why. I have a vim command that I use that Tidies different files. :Tidy When it's perl code, it uses the Perl::Tidy. If it's JSON, then it formats it nicely using JSON::PP. Recently I've been doing comparisons of serialized JSON data (to make sure it's formatted correctly) and it would be nice if the order was maintained when being Tidied. Performance isn't critical, it's an editor command; not used in production.

Replies are listed 'Best First'.
Re^3: Preserve the order in JSON
by Anonymous Monk on Oct 21, 2020 at 03:50 UTC
    I've been using a one-liner. json_pp -f json -t json -json_opt pretty. I may end up implementing it using Hash::Ordered
Re^3: Preserve the order in JSON
by Anonymous Monk on Oct 21, 2020 at 08:44 UTC
    Use the ordering/sorting feature then nobody is stopping you