CraftTools

JSONPath Tester

Guide: How to Fix the Most Common JSON Errors

Nothing you enter or choose here leaves your device. This tool runs in your browser.

A query on a bookstore

JSONPath is a small language for picking values out of JSON. Say your data is a store with a list of books, each with a title, a price and a category, and a bicycle with its own price. Here are queries you can paste in with that data, and what they return:

QueryWhat it returns
$.store.book[*].titleEvery book title
$.store.book[0,2].titleThe titles of the first and third books
$.store.book[-1:]The last book
$..priceEvery price anywhere in the document
$.store.book[?(@.price < 10)].titleTitles of books under 10
$.store.book[?(@.price < 10 && @.category == 'fiction')].titleCheap fiction only

The building blocks

  • $ is the root of the document. Every query starts with it.
  • .name selects a key. ['name'] does the same when the key has spaces or symbols.
  • [0] picks an item by position, counting from zero. A negative number counts from the end.
  • [*] selects everything at that level.
  • [0:2] is a slice, from item 0 up to but not including item 2.
  • .. searches at every depth, so $..price finds prices wherever they hide.
  • [?(...)] filters. Inside, @ means the current item.

Why you get no matches

  1. Check that the path starts with $.
  2. Check the spelling and the capital letters of key names. They have to match exactly.
  3. Check that quotes and brackets are balanced.
  4. In filters, check the type. The number 10 and the text "10" are different, and a comparison between them finds nothing.
  5. Look at the data. A key you expect may sit one level deeper, so try $..key to find it.

Every match shows where it came from

Each result lists the path to the value, such as $.store.book[1].title. That's useful when a recursive search finds more than you wanted, since you can tell the matches apart. Copy values gives you the results as a JSON list.

Safe to paste any query

Filter expressions are read by a small parser built into the page. They're never run as JavaScript, so a query copied from somewhere else can't execute code.

A note on dialects

JSONPath isn't a single strict standard, and tools differ on edge cases like filter syntax and what a missing key returns. If a query works here and not in your library, check its documentation on filters and on recursive search.

Everything runs in your browser. Tidy the data first with the JSON formatter, compare two versions with the JSON diff, which prints paths in the same style, or describe its shape with the JSON schema generator.

Written by Akinrinmade Michael · Updated October 24, 2026

How to use

  1. 1Paste your JSON into the left box.
  2. 2Type a JSONPath expression, or click an example.
  3. 3Read the matches and their paths on the right.
  4. 4Click Copy values to copy the results as a JSON list.

Frequently asked questions

What is JSONPath?

A query language for JSON, similar to XPath for XML. $ is the root, a dot selects a key, and [*] selects every item, so $.store.book[*].title lists every book title.

Which features are supported?

Child names, array indexes (including negative), wildcards, slices like [0:2], unions like [0,2], recursive search with .., and filters such as [?(@.price < 10 && @.category == 'fiction')].

Why do I get no matches?

Check the spelling and the case of key names, that your path starts with $, and that quotes are balanced. Filters only compare values of the same type, so 10 and "10" are different.

Does it run my filters as code?

No. Filter expressions are read by a small built-in parser, never evaluated as JavaScript, so pasted queries can't run code.

Read the guide

Learn how this works and how to get the most from it.

Developer

How to Fix the Most Common JSON Errors

Trailing commas, single quotes, unquoted keys and more. Learn to read a JSON error message and fix invalid JSON quickly.

4 min read

JSON Formatter & Validator

Prettify, minify and validate JSON, with error line numbers.

JSON Diff

Compare two JSON documents and see what changed, ignoring key order.

JSON Schema Generator

Generate a JSON Schema from a sample JSON document.

YAML ⇄ JSON Converter

Convert YAML to JSON and JSON to YAML with error line numbers.