SyntaxStudy
Sign Up
MySQL Extracting JSON Values
MySQL Beginner 3 min read

Extracting JSON Values

JSON_EXTRACT

Use JSON_EXTRACT() or the shorthand -> operator to read values from a JSON column using JSONPath syntax.

Example
SELECT
  name,
  attributes->'$.color'  AS color,
  attributes->'$.ram'    AS ram
FROM products;

-- JSON_EXTRACT equivalent
SELECT JSON_EXTRACT(attributes, '$.color') FROM products;
Pro Tip

Use ->> (double arrow) to unquote strings: returns black instead of "black".