JSON_EXTRACT
Use JSON_EXTRACT() or the shorthand -> operator to read values from a JSON column using JSONPath syntax.
Use JSON_EXTRACT() or the shorthand -> operator to read values from a JSON column using JSONPath syntax.
SELECT
name,
attributes->'$.color' AS color,
attributes->'$.ram' AS ram
FROM products;
-- JSON_EXTRACT equivalent
SELECT JSON_EXTRACT(attributes, '$.color') FROM products;
Use ->> (double arrow) to unquote strings: returns black instead of "black".