JSONPath Query
Pull exactly the data you need out of long JSON with a JSONPath expression — such as every user's name, or only products under 10.
How to query JSON with JSONPath
- Paste your JSON into the left box.
- Type a JSONPath expression into the "Path" box, always starting with $ — for example $.users[*].name to get the name of every user.
- The result is a list of the values found. Turn on "Show where each value was found" to see the path of every value.
Frequently asked questions
$ is the whole document. .name takes a field, [0] takes the first item of a list, [-1] the last, [*] all of them, [1:3] the 2nd and 3rd items, and ..name finds that field at any depth. For example: $.users[0].name or $..price.
Use [?(...)], where @ is each item being checked. For example $.products[?(@.price < 10)] takes the products priced under 10. You can compare with ==, !=, <, <=, > and >=, and combine conditions with && (and), || (or) and ! (not). Just write [?(@.isbn)] to keep the items that have that field.
Put the name in square brackets and double quotes, for example $["first name"] or $.users[0]["first-name"].
A path can match several values, so the result is always a list. If only one value matches, the list has exactly one item, and if nothing matches it is the empty list [].
Yes, in filters. length(@.name) counts the characters of text (or the items of a list), count(@.tags[*]) counts the values found, value(@..color) gives the single value found, match(@.name, "^An") checks that the whole text fits a pattern, and search(@.name, "An") checks that the text contains the pattern. For example: $.users[?(length(@.name) > 3 && match(@.name, "^B"))].
Basic regex syntax: plain characters, a dot (any one character), [abc] and [a-z], [^abc] (anything but), * + ? and exact repeat counts, | (or), groups (…), ^ and $ (start and end of the text), \d \w \s, \b (word edge) and Unicode groups such as \p for capital letters. There are no look-aheads or look-behinds (?=…) and no back-references (\1). In return, a pattern always runs fast — even a badly written one can't freeze the page. Note: in the query a backslash is written twice, for example \"\\d+\" for the pattern \d+.
No. Numbers are kept exactly as they are in the JSON, and when you filter by a number the comparison is exact to the last digit.
No. The JSON is processed right on your device.
It's completely free, no account needed.
Related tools
JSON to YAMLConvert between JSON and YAMLJSON to TOMLConvert between JSON and TOMLJSON to CSVConvert between JSON and CSV tablesJSON to XMLConvert JSON to indented XMLJSON to TypeScriptGenerate TypeScript interfaces from sample JSONJSON to JSON SchemaGenerate a JSON Schema from a JSON sampleJSON Schema validatorCheck whether JSON data matches a JSON SchemaJSON to ZodGenerate a Zod schema from a JSON sampleJSON to Go structGenerate Go structs from a JSON sample