SyntaxStudy
Sign Up
MySQL JSONPath Syntax Reference
MySQL Intermediate 3 min read

JSONPath Syntax Reference

JSONPath Syntax

JSONPath in MySQL: $ is the document root, .key selects a key, [n] selects an array index, [*] selects all elements.

Example
-- Given: {"user": {"name": "Alice", "tags": ["admin", "dev"]}}
SELECT
  data->'$.user.name',          -- "Alice"
  data->'$.user.tags[0]',       -- "admin"
  JSON_EXTRACT(data, '$.user.tags[*]')  -- ["admin","dev"]
FROM settings WHERE id = 1;
Pro Tip

Use [last] to select the last element of a JSON array.