MySQL JSON Summary
MySQL's JSON type provides validation, path extraction (->), modification (JSON_SET), aggregation (JSON_ARRAYAGG), and search functions. Generated columns enable indexing.
MySQL's JSON type provides validation, path extraction (->), modification (JSON_SET), aggregation (JSON_ARRAYAGG), and search functions. Generated columns enable indexing.
-- Common JSON operations cheatsheet
-- Read: col->'$.key' or JSON_EXTRACT(col, '$.key')
-- Unquote: col->>'$.key' or JSON_UNQUOTE(JSON_EXTRACT(...))
-- Set: JSON_SET(col, '$.key', value)
-- Remove: JSON_REMOVE(col, '$.key')
-- Append: JSON_ARRAY_APPEND(col, '$', value)
-- Search: JSON_SEARCH(col, 'one', value)
-- Exists: JSON_CONTAINS_PATH(col, 'one', '$.key')
Bookmark this cheatsheet — JSON function names are easy to confuse.