5 min read
Also: JSON Path, RFC 9535, JSONPath expression, JSONPath query, JSONPath filter, JSONPath syntax
JSONPath
Quick answer
JSONPath is a query language for picking values out of JSON, such as $.store.book[*].author or the filter $..book[[email protected] < 10], standardised as RFC 9535 in February 2024. To try an expression against your own data, paste both into the free JSONPath evaluator.
JSONPath is a query language for selecting values from JSON documents, written as path expressions such as $.store.book[0].title. It began as Stefan Gössner's 2007 proposal and was standardized by the IETF as RFC 9535 in February 2024.
Last verified
What people do with JSONPath
- Test a JSONPath expression online
Paste JSON and an expression, see the matches, with a syntax cheat sheet.
- Format and validate JSON before querying it
Find the syntax error that makes every JSONPath query return nothing.
- Convert CSV to JSON so you can query it
Turn a spreadsheet export into an array of objects.
- Compare with XPath, the HTML equivalent
JSONPath was modelled on XPath; test XPath queries on HTML here.
- Pick fields from an API response without code
HTTP Request steps store JSON responses for later steps to read.
Key facts
| Standard | IETF RFC 9535, Proposed Standard, published February 2024 |
|---|---|
| Authors | Stefan Gössner, Glyn Normington, Carsten Bormann |
| Origin | Stefan Gössner's JSONPath proposal of 21 February 2007 |
| Root identifier | $ (the whole JSON value); @ is the current node inside a filter |
| Built-in functions (RFC 9535) | length(), count(), match(), search(), value() |
| Notable users | kubectl -o jsonpath templates; AWS Step Functions (default query language) |
What is JSONPath?
JSONPath is a small query language for picking values out of JSON. An expression such as $.orders[0].id means "from the root, take the orders array, its first element, and that element's id." It plays the same role for JSON that XPath plays for XML, and that comparison is where it came from.
This page covers JSONPath as a named standard: where it came from, why implementations disagree, and where you will meet it. For the syntax itself and a place to try expressions against your own data, use the JSONPath evaluator, which includes a full cheat sheet.
Who made it: from a 2007 blog post to RFC 9535
Stefan Gössner published the original JSONPath proposal on 21 February 2007 as "XPath for JSON." It was a short article with a reference implementation in JavaScript and PHP, not a formal specification. The design deliberately delegated parts of the language to the host programming language: filter expressions like ?(@.price < 10) were often evaluated as JavaScript.
That shortcut made JSONPath easy to adopt and hard to port. Over the next fifteen years dozens of libraries implemented their own reading of the article, and they diverged on details the article did not pin down. In 2020 the IETF formed a JSONPath working group, and in February 2024 it published RFC 9535, "JSONPath: Query Expressions for JSON", a Proposed Standard authored by Stefan Gössner, Glyn Normington and Carsten Bormann. Its stated goal is a common specification that behaves the same across languages and environments.
How JSONPath works
A JSONPath query is applied to a JSON value and returns a nodelist: zero or more of the values inside it, in document order. The building blocks are:
.name, ['name'], [0]) or into all descendants (..).[0:5]), wildcards (*) and filters.[[email protected] < 10]), where @ stands for the element being tested. RFC 9535 also allows the older parenthesized form.RFC 9535 adds a small, typed function system with five built-in functions: length(), count(), match(), search() and value(). The match() and search() functions use I-Regexp (RFC 9485), a deliberately limited regular-expression dialect that behaves the same everywhere.
A query that selects nothing is not an error. It returns an empty nodelist, which is why a typo in a path often surfaces later as a missing value rather than at the step that caused it.
Where implementations still disagree
Most JSONPath code in production predates RFC 9535, so "JSONPath" can still mean slightly different things depending on the tool:
$..book[(@.length-1)] and evaluated it as code. RFC 9535 has no script expressions; use [-1].in, =~ regex matching, or contains; the RFC uses functions such as match() instead.If an expression works in one tool and not another, these are the first things to check.
Where you will meet JSONPath
kubectl get pods -o jsonpath='{.items[*].metadata.name}' uses JSONPath templates, wrapped in curly braces, to format output. The Kubernetes docs note that regular expressions are not supported there and suggest jq for that.InputPath, ResultSelector, ResultPath, OutputPath). Since late 2024 a workflow can opt into JSONata instead, per state or for the whole state machine.JSONPath in automation
Most automation is JSON plumbing: an API returns a payload and the next step needs the id, the status or the list of line items from it. JSONPath, or a simplified dot-path that covers its child-and-index subset, is how that field gets named without writing code. Related reading: API integration and structured data.
In Autonoly, an HTTP Request step stores the response in a variable, and later steps reference fields with a dot path such as ${trigger.body.status}. That covers plain child and index access, not full RFC 9535 filters. To filter or reshape a list, use the data processing nodes or a JavaScript Transform Data step. Incoming webhooks work the same way.
Why It Matters
JSONPath is how configuration files, API tests, Kubernetes commands and workflow tools name a value inside JSON. Knowing that it only became a formal standard in 2024 explains why the same expression can behave differently between libraries.
How Autonoly Solves It
Autonoly workflows pass JSON between steps. HTTP Request and webhook steps store the response, and later steps pick fields with dot paths like ${trigger.body.status}, which cover JSONPath's child and index access. Filtering and reshaping lists is done with data processing nodes or a JavaScript Transform Data step rather than full JSONPath filters.
Learn moreExamples
Running kubectl get pods -o jsonpath='{.items[*].status.podIP}' to print every pod IP in a namespace
Using ResultSelector with JSONPath in an AWS Step Functions task to keep only the fields a later state needs
Picking the id of a newly created record from an API response in one workflow step and passing it to the next request
Frequently Asked Questions
Is JSONPath an official standard?
Yes, since February 2024. The IETF published RFC 9535, 'JSONPath: Query Expressions for JSON', as a Proposed Standard. Before that, JSONPath was defined only by Stefan Gössner's 2007 article, which is why older libraries disagree on details.
Who created JSONPath?
Stefan Gössner, who published the original proposal on 21 February 2007 as an XPath-like query language for JSON. He is also a co-author of RFC 9535, together with Glyn Normington and Carsten Bormann.
Why does the same JSONPath expression give different results in different tools?
Most libraries were written before RFC 9535 and interpreted the 2007 article differently. They differ on script expressions, extra filter operators, regex support, escaping, and whether a single match returns a value or an array. Check which dialect your tool implements.
What is the difference between JSONPath and jq?
JSONPath is a path expression for selecting values, usually embedded in another tool such as kubectl or a workflow step. jq is a complete command-line language that can also transform and reshape JSON. Use JSONPath to select, jq to reshape.
Does kubectl support full JSONPath?
kubectl supports JSONPath templates wrapped in curly braces, with additions such as range and end for iteration. Its documentation says regular expressions are not supported and recommends jq when you need them.
Does AWS Step Functions still use JSONPath?
Yes. JSONPath is the default query language. Since late 2024 you can opt into JSONata at the state machine or state level, which replaces the five JSONPath fields such as InputPath and ResultSelector with Arguments and Output.
Further reading
Related terms, automations and guides
Where this concept shows up in practice.
Stop reading about automation.
Start automating.
Describe what you need in plain English. Autonoly's AI agent builds and runs the automation for you — no code required.