Skip to content

JSONPath Query Tester

Paste a JSON document, choose a JSONPath expression, and see exactly which values it matches. Results come back as a JSON array with a match count and can be explored as a tree. Nothing leaves your browser.

Loading editor...
Paste or type JSON
Loading editor...
Matches
Auto-run ON

How to test a JSONPath expression

  1. Paste your JSON into the left panel, upload a .json file, or load it from a URL. Click Sample to load a small bookstore document to experiment with.
  2. Type an expression in the JSONPath box on the output toolbar, or pick one of the suggestions that appear when you focus it. The query re-runs as you type (or press Enter), and the toast shows the match count, for example 3 matches.
  3. The matches appear on the right as a JSON array. Switch to Tree to expand nested results.
  4. Click Copy or Download .json to keep the extracted values.

If the input is not valid JSON, the error bar shows the line and column; click Fix to repair it.

Example

Input:

{
  "store": {
    "books": [
      { "title": "JSON at Scale", "author": "A. Rao", "price": 29.99, "inStock": true },
      { "title": "Structured Logging", "author": "B. Lee", "price": 18.5, "inStock": false },
      { "title": "APIs by Example", "author": "C. Diaz", "price": 24, "inStock": true }
    ],
    "location": { "city": "Pune", "country": "IN" }
  }
}

Expression $.store.books[?(@.price < 25)] reports 2 matches:

[
  { "title": "Structured Logging", "author": "B. Lee", "price": 18.5, "inStock": false },
  { "title": "APIs by Example", "author": "C. Diaz", "price": 24, "inStock": true }
]

JSONPath syntax in brief

  • $ is the root. On its own it returns the whole document as a one-element array.
  • .key selects a property: $.store.location.city gives ["Pune"].
  • [*] selects every element of an array: $.store.books[*].title gives the three titles.
  • [?(@.price < 25)] is a filter, where @ is the element being tested. [?(@.inStock)] keeps elements whose property is truthy, so $.store.books[?(@.inStock)].author gives ["A. Rao", "C. Diaz"].
  • .. is recursive descent: $..city finds a city key at any depth.
  • [-1:] is a slice: $.store.books[-1:] gives the last book, [0:2] the first two.

Limits and notes

  • Files up to 5 MB. Queries run as JavaScript in your browser; nothing is uploaded.
  • The suggestions are written around the sample document. $ and $..city work on any document, but a suggestion such as $.store.books[*].title only matches JSON with that shape; type your own path for your data.
  • The engine is jsonpath-plus. Its filters accept JavaScript-style comparisons such as <, == and &&; other implementations (Java JsonPath, jq, Postgres) differ in details, so test expressions in your target library too.
  • Results are values only; matched paths are not listed. The tree view's copy-path button gives the path of any selected value.
  • For the differences between the two addressing schemes, see JSONPath vs JSON Pointer. For the shell equivalent, see the jq cheat sheet, and to turn nested matches into flat columns, see flatten nested JSON.

Frequently Asked Questions

Why are the results always wrapped in an array?
A JSONPath expression can match any number of values, so the result is the list of matches. A single match is a one-element array, which keeps it distinct from a match that is itself an array.
My query returns 0 matches. Is that an error?
No. An empty result means nothing in the document satisfied the expression. Keys are case-sensitive, and a filter such as [?(@.price < 25)] only matches elements that have a numeric price.
What is the difference between $.store.books[*] and $..books?
[*] selects every element of one specific array. The .. operator is recursive descent: it searches every level of the document for a key, which is handy when you do not know the exact path.
Is JSONPath the same as JSON Pointer?
No. JSON Pointer (/store/books/0/title) addresses exactly one location and is used by JSON Patch and JSON Schema. JSONPath is a query language that can return many values and supports wildcards and filters.
Is my data uploaded?
No. The query engine runs as JavaScript in your browser tab, so your JSON stays on your machine.

Guides that go with this tool

More JSON tools

JSON Viewer (Tree View)

Explore any JSON document as a collapsible tree in your browser. Click a key to copy its JSONPath, click a value to copy it, and page through large arrays without freezing the tab.

JSON Fixer: Repair Invalid JSON

Repair broken JSON in your browser. Strips markdown fences and prose, fixes trailing commas, single quotes, comments, unquoted keys, Python literals and unclosed brackets, and lists every problem it detected.

JSON to CSV Converter

Convert a JSON array of objects to CSV in your browser. Nested objects are flattened to dotted columns, values are quoted correctly, and Excel-friendly output is one click away.

CSV to JSON Converter

Convert CSV with a header row into a JSON array of objects in your browser. Numbers and booleans are detected, leading-zero codes stay strings, and the delimiter is picked up automatically.

JSON to YAML Converter

Convert JSON to clean YAML in your browser with 2, 3 or 4 space indentation. Strings that a YAML parser would read as numbers, booleans or dates are quoted so they survive the round trip.

YAML to JSON Converter

Convert YAML to JSON in your browser. Multi-document files become an array, anchors and aliases are resolved, and only null, true, false and plain numbers are typed, so yes, NO and dates stay strings.

JSON to XML Converter

Convert JSON to XML in your browser. Choose the root and array item element names, nulls become xsi:nil, keys are sanitised into valid XML names, and text is escaped.

XML to JSON Converter

Convert XML to JSON in your browser. Attributes are kept as @_name keys, repeated tags become arrays, numbers and booleans are detected, and invalid XML reports the line and column.

JSON Compare (Diff)

Compare two JSON documents in your browser and get a structural diff that lists every changed, added, and removed value with its JSONPath. Key order and whitespace are ignored.

JSON Escape / Unescape

Escape text into a JSON string literal, unescape one back to plain text, or stringify a whole JSON document to embed it inside another JSON value or in source code.