MySQL JSON Path Tester
MySQL JSON paths look simple until one returns NULL, wraps a single value in an array or fails with ERROR 3143 Invalid JSON path expression. Paste a JSON document and one or more paths, one per line. For each valid path you get the result of JSON_EXTRACT, the unquoted ->> value and JSON_CONTAINS_PATH, and every location the path matched (for example $.items[1].sku), so you can see what * , ** and ranges such as [1 to last] really select. You also see whether the path can be used in JSON_SET, JSON_REPLACE and JSON_REMOVE or would fail with ERROR 3149. Invalid paths get the same ERROR 3143 message and character position MySQL reports, a marker under the problem and the likely fix, such as quoting a key that contains a space or a hyphen. Invalid documents get the ERROR 3141 message and position. Results use MySQL's own output format: keys sorted the way MySQL stores them, ", " separators and MySQL's number formatting. The behavior was checked against MySQL 8.4.11 with 20,000 generated paths and 3,048 number and invalid-document cases, with no differences. Everything runs in your browser; the document is never uploaded.
Do more than mysql json path tester — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Paste the JSON document (a column value, an API payload or a sample row) into the first box.
- Enter the paths to test, one per line, exactly as they appear inside the SQL string, and set the column name used in the generated SQL.
- Click Test paths and read each result, the matched locations and any ERROR 3143 explanation, then copy the generated SELECT, JSON_TABLE or index statement.
Frequently asked questions
Why does MySQL say Invalid JSON path expression (ERROR 3143)?
The path text breaks MySQL's path grammar. The most common causes are a key with a space, hyphen or leading digit written without quotes ($.order-id must be $."order-id"), a negative index such as [-1] (use [last]), the JSONPath-style .. operator (MySQL uses $**.name), single quotes around a key, a range whose start is greater than its end ([3 to 1]) and a path that does not start with $. The position in the message counts bytes from the start of the path, so a multi-byte character before the problem shifts it. This tester shows the position with a marker and names the likely cause.
Why does JSON_EXTRACT return an array when I expect a single value?
A path that can match more than one value, because it contains *, ** or a range such as [0 to 2], always returns its matches wrapped in a JSON array, even when only one value matches: JSON_EXTRACT(doc, '$**.city') returns ["Lisbon"], not "Lisbon". Passing several paths to one JSON_EXTRACT call also wraps the results. If you need one row per match, use JSON_TABLE(doc, '$.items[*]' COLUMNS (...)). If you need a scalar, use an exact path such as $.items[0].sku.
What is the difference between ->, ->> and JSON_EXTRACT in MySQL?
col->'$.path' is shorthand for JSON_EXTRACT(col, '$.path') and returns JSON, so strings keep their double quotes. col->>'$.path' is JSON_UNQUOTE(JSON_EXTRACT(col, '$.path')) and returns plain text, which is what you usually want in WHERE clauses, comparisons and output. Both operators only accept a column on the left and a single path. When no value matches, all three return SQL NULL, which is not the same as a JSON null value. To try paths against real rows, connect to MySQL with Chat2DB (download it at chat2db.ai/download or open app.chat2db.ai) and run the generated queries.
