upvote
One handy bit of SQLite's JSON features which isn't called out in this article is the short syntax, e.g.

    SELECT payload->>'$.user.id' AS user_id FROM events ...
This works a little more consistently than JSON_EXTRACT - the -> operator always returns a JSON string; the ->> operator (used here) always returns a SQL scalar (text, number, or null). More details: https://sqlite.org/json1.html#jptr
reply
Everybody has a JSON extension, and they're all slightly different.

I just got hit badly by Dreamhost, which is still running MySQL 8.0. That version has a "JSON extension" which is almost totally useless. I designed something before discovering how different MySQL 8.4 and MySQL 8.0 are.

reply
That does seem cool. So there are sufficient functions to iterate through collections that might be stored in a single row of a JSON column?
reply
Yes, using the table-valued JSON functions like JSON_EACH and JSON_TREE (which works recursively). Details: https://sqlite.org/json1.html#table_valued_functions_for_par...
reply