News for hackers. Stuff that matters.
Re:JSONB Has Landed in SQLite by sgbeal on Wednesday December 06, 2023 @01:06PM (#38547427)
> There’s a huge nuance worth mentioning: with JSONB you lose key ordering in objects.

JSON never guarantees any ordering. From json.org:

> An object is an unordered set of name/value pairs.

If you depend on a given implementation doing so, you're depending on a quirk of that implementation, not on a JSON-defined behavior.

Re:JSONB Has Landed in SQLite by pie_flavor on Wednesday December 06, 2023 @01:37PM (#38547825)
Using a function to query a fact about a string does not imply that the string should change, regardless of what guarantees are present within the format that the string is in. If you expect to get out the same string you put in, then there's nothing implementation-quirk about that.
Re:JSONB Has Landed in SQLite by sgbeal on Wednesday December 06, 2023 @01:42PM (#38547887)
> Using a function to query a fact about a string does not imply that the string should change, ... then there's nothing implementation-quirk about that.

Fair enough when considering only the string value. My ill-expressed point was more about JSON as a data exchange format - it may pass through any number of JSON parser/storage implementations, any of which may use an arbitrary order for the keys.

Re:JSONB Has Landed in SQLite by ric2b on Thursday December 07, 2023 @05:50PM (#38562895)
You're not storing a string, you're storing a JSON object. If you want to store a string use TEXT or VARCHAR.
Re:JSONB Has Landed in SQLite by pie_flavor on Friday December 08, 2023 @05:09PM (#38575252)
That is what this post chain is about. The nuance between choosing to store your JSON as a string in a TEXT column or as JSONB in a BLOB column.