http://qs1969.pair.com?node_id=1130765


in reply to Preserve the order in JSON

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". ;-)