![]() |
|
No such thing as a small change | |
PerlMonks |
Re: Preserve the order in JSONby afoken (Canon) |
on Jun 17, 2015 at 07:17 UTC ( #1130765=note: print w/replies, xml ) | Need Help?? |
is there a way to preserve the order Not exactly, but JSON can sort JSON object keys. You need to call $json->canonical() before $json->encode($data). Note that this adds some significant overhead. The big question remains: Why do you need sorted keys in the object? Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|