News for hackers. Stuff that matters.
Re:JSONB Has Landed in SQLite by magicalhippo on Wednesday December 06, 2023 @12:50AM (#38540841)
Given that the order of the keys is specified as having no significance in regular JSON[1], this is out-of-spec usage.

If key order has to be preserved then a blob type would be a better fit, then you're guaranteed to get back what you wrote.

For example, SQLite says it stores JSON as regular text but MySQL converts it to an internal representation[2], so if you migrate you might be in trouble.

[1]: https://ecma-international.org/publications-and-standards/st...

[2]: https://dev.mysql.com/doc/refman/8.0/en/json.html

Re:JSONB Has Landed in SQLite by devit on Wednesday December 06, 2023 @08:13AM (#38543397)
You can also add a property to all objects with an array of keys in the order you want (if you can guarantee it won't conflict with existing properties, or can escape those), or turn them into a {k, o} array where k is the key array and o the object or a {k, v} array where v is a value array if you don't care about looking up keys.