SQLite JSON Functions
SQLite JSON Functions is a SQL function in the SQLite Specific category. SQLite 3.9+: built-in JSON functions without extensions. Supports JSON path queries and modifications. The syntax is json_extract(data, '$.path'), json_set(data, '$.path', value). It accepts see syntax. It returns jSON query/modify. A typical example: CREATE TABLE products (id INT, data TEXT); INSERT INTO products VALUES (1, '{"name": "Widget", "tags": ["new", "sale"]}'); -- Extract value: SELECT json_extract(data, '$.name') FROM products; -- Widget -- JSON path with array: SELECT json_extract(data, '$.tags[0]') FROM products; -- new -- JSON update: UPDATE products SET data = json_set(data, '$.price', 9.99) WHERE id = 1; -- JSON each (table function): SELECT value FROM products, json_each(data, '$.tags'); -- new, sale -- JSON… A close relative is AUTOINCREMENT (SQLite), which sQLite: unlike AUTO_INCREMENT in MySQL, only INTEGER PRIMARY KEY columns auto-increment. AUTOINCREMENT guarantees unique increasing IDs. A close relative is ROWID / _ROWID_, which sQLite: every row has an implicit 64-bit ROWID. INTEGER PRIMARY KEY becomes an alias for ROWID.