SQLite JSON Functions Cheatsheet/Join against JSON array values in a column

Search inside per-row arrays.

Section: Update and expand JSON

Join against JSON array values in a column

sql
sql
SELECT a.id, je.value AS role
FROM accounts a,
     json_each(a.roles_json) AS je
WHERE je.value = 'admin';
Explanation

Great for analytics and migrations, though highly queried JSON fields are often better normalized or indexed via generated columns.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Update and expand JSON
Expand an array with json_each
Turn array elements into result rows.
OpenIn sheetsqlsame section
Update or insert a JSON field
Patch a document with json_set().
OpenIn sheetsqlsame section
Remove a JSON key
Delete one path from a document.
OpenIn sheetsqlsame section
Extract a JSON field
Read one property from a JSON document.
OpenIn sheetsql1 tag match
Use JSON operators
Read a JSON path with operator syntax.
OpenIn sheetsql1 tag match
Validate JSON text
Check whether a string contains valid JSON.
OpenIn sheetsql1 tag match