Skip to content
Home

/

Glossary

/

Data

/

JSONPath

Data

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

Key facts

StandardIETF RFC 9535, Proposed Standard, published February 2024
AuthorsStefan Gössner, Glyn Normington, Carsten Bormann
OriginStefan 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 userskubectl -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:

  • The root identifier `$`, which every query starts from.
  • Segments that step into children (.name, ['name'], [0]) or into all descendants (..).
  • Selectors for names, indexes (including negative ones counting from the end), slices ([0:5]), wildcards (*) and filters.
  • 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:

  • Script expressions. Old implementations accepted $..book[(@.length-1)] and evaluated it as code. RFC 9535 has no script expressions; use [-1].
  • Filter syntax and operators. Some libraries support in, =~ regex matching, or contains; the RFC uses functions such as match() instead.
  • Return shape. Some tools return a single value when one node matches and an array when several do; the RFC always returns a nodelist.
  • Quoting and escaping of member names with dots, spaces or unicode.
  • If an expression works in one tool and not another, these are the first things to check.

    Where you will meet JSONPath

  • Kubernetes. 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.
  • AWS Step Functions. JSONPath is the default query language for state input and output (InputPath, ResultSelector, ResultPath, OutputPath). Since late 2024 a workflow can opt into JSONata instead, per state or for the whole state machine.
  • API testing. Tools such as ReadyAPI (via the Jayway JsonPath library) use JSONPath to assert on response fields.
  • Automation and integration platforms, where one step needs one field from the previous step's JSON response.
  • 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 more

    Examples

    • 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

    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.

    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.

    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.

    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.

    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.

    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.

    Related terms, automations and guides

    Where this concept shows up in practice.

    DefinitionStructured DataStructured data is information organized in a predefined, predictable format — typically rows and columns in databases, spreadsheets, or tabular files like CSV and JSON. Each field has a defined type and position, making it easy to query, filter, and analyze programmatically.DefinitionAPI IntegrationAPI integration is the process of connecting two or more applications through their APIs so they can exchange data and trigger actions automatically. It eliminates manual data entry by letting systems communicate directly with each other in real time.DefinitionCSS SelectorA CSS selector is a pattern used to identify and target specific HTML elements on a web page, widely used in browser automation to locate buttons, forms, text, and other interactive elements.DefinitionIMPORTXMLIMPORTXML is a Google Sheets function that fetches a URL from Google's servers and returns whatever an XPath query selects from the page, such as titles, prices or links. It reads only the raw HTML, so it cannot see content that JavaScript adds after the page loads.DefinitionGoogle Sheets APIThe Google Sheets API is Google's REST API for reading and writing Google Sheets from your own code. Version 4 exposes cell values, formatting, charts and sheet structure, and is limited by per-minute quotas of 300 requests per project and 60 per user, separately for reads and writes.GuideHow to Scrape and Crawl Dynamic Websites (Why JavaScript Pages Come Back Empty)Why requests, BeautifulSoup and Google Sheets' IMPORTXML return empty results on JavaScript pages, and the four ways to get the data: embedded JSON, the site's own XHR/JSON endpoints, a rendered browser with proper waits, and handling infinite scroll, load-more buttons and JS-built links when crawling.GuideIMPORTXML "Could Not Fetch URL" and "Imported Content Is Empty": Causes and FixesWhy Google Sheets' IMPORTXML and IMPORTHTML return "Could not fetch url", "Imported content is empty" or endless Loading, how to tell which cause you have in a minute, and what to use when the page is JavaScript-rendered, blocked or behind a login.DefinitionIMPORTHTMLIMPORTHTML is a Google Sheets function that imports a whole HTML table or list from a web page into your spreadsheet, chosen by its position on the page. It is the quickest way to pull a static table into Sheets, and it shares IMPORTXML's limits: no JavaScript, no logins, hourly refresh.

    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.

    See Features