You can count on object key order being preserved when you control the implementation. Which is why it's useful to know whether a given implementation preserves key order.
There are situations where keeping order is useful. For example, human-editable json config files.
I also gave an example of two implementations that are compatible for a useful subset of keys. By the way, SQLite JSONB keeps object keys in insertion order, similar to Python: https://news.ycombinator.com/item?id=38547254
Re:JSONB Has Landed in SQLite
by cryptonector on Wednesday December 06, 2023 @06:28PM
(#38550908)
> There are situations where keeping order is useful. For example, human-editable json config files.
You might have to just normalize every time you want to edit that.
For any one implementation. But there's a very large number of implementations. You just can't count on object key order being preserved, so don't.