logoalt Hacker News

duskwufftoday at 6:49 PM0 repliesview on HN

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