json

FormatValidateConvert

Start over?

This clears both panes. Unsaved changes in either document are lost.

Replace that document?

This writes the matches into the other pane. What is there now is lost.

Load JSON from a URL

Your browser fetches it directly — the request goes to that site, never to us.

    ↑ ↓ to move · Enter to run · Esc to close

    Keyboard shortcuts

    Send feedback

    Questions, bug reports and feature requests are all welcome. A bug report is easiest to act on with the shape of the document that caused it — never send anything confidential.

    Email us

    Contact page, in a new tab, so this page stays as it is.

    Settings

    Indent

    Format and Sort keys write it, and Tab in Code view types it.

    Code text size
    14 px

    Code view and generated code.

    Wrap long lines
    Left pane opens in
    Right pane opens in

    In a new tab and after New. A view you choose in a pane is still remembered.

    JSONPath Tester

    On the left pane · one documentOn one document
    0
    0

    About the JSONPath tester

    JSONPath Tester: query JSON with RFC 9535 paths.

    Your document never leaves the browser.

    Query a document in the same private workspace as the JSON editor, with Tree view and JSONPath Query mode ready without loading or changing your data.

    What JSONPath is

    A text search answers one question: where does this word appear? Much of the time that is the wrong question for JSON. You want the name of every user, the identifier of each record that is still active, or the third item of a list nested two levels down, and the word you would search for either appears in a hundred places or not at all. JSONPath is a small language for naming positions in a document instead. A path starts at the root, written as a dollar sign, and walks inward one step at a time: into a member by its name, into an array by its index, across every child with a star, or down through every level with two dots.

    For years there was no standard. The original 2007 article left many details open, and each library filled them in its own way, so the same path could return different results in different tools. RFC 9535, published in 2024, settled the grammar and the meaning, and that is the version this page follows where it can. This tester is the editor’s own Find bar switched into Query mode, the braces button beside the search box. The page opens with that mode already on, in Tree view, so a path typed into the box is read as a path from the first keystroke. Open a file or a sample, or switch the pane to Code and paste a document, and every node the path selects is highlighted in place.

    The supported RFC 9535 subset

    The example document below holds two users and a meta object, and each of the three queries under it comes with the matches it returns, written as JSON Pointers. The first, the descendant query for id, finds all three id members wherever they sit, including the one inside meta that has nothing to do with users. The second filters the users array: the question mark opens a filter, the at sign stands for the element being tested, and only Ada is active, so only her name is selected. The third is a slice, the first two elements of the array, and like a slice in most programming languages its end is left out.

    Those constructs make up most of the language. Member names can be written with a dot or quoted inside square brackets when they contain spaces or punctuation, indexes may be negative to count from the end, and the star selects every child of an object or an array. Inside a filter, comparisons use the six familiar operators, tests combine with and, or and not, and a field on its own passes when it exists and is not false, null or an empty string. Older tools wrapped filters in round brackets, and that form is still accepted, so a query copied from an old answer keeps working. Four shortcuts go beyond the standard because they are quick to type in a one-line box: starts with, ends with, contains and a regular expression match.

    While a path is valid, the counter on the bar shows which match is current and how many there are, and Enter and Shift+Enter step between them. The funnel button hides every row that is neither a match nor on the way to one, which makes a large document readable around its answer. The Tree view is where this page begins, but the same query runs unchanged in Table and Graph, and switching views keeps the matches in place.

    1

    The document

    {
      "users": [
        { "id": 7, "name": "Ada", "active": true },
        { "id": 12, "name": "Grace", "active": false }
      ],
      "meta": { "id": "batch-4" }
    }
    2

    Three queries, and what each matches

    $..id
    /users/0/id
    /users/1/id
    /meta/id
    
    $.users[?@.active == true].name
    /users/0/name
    
    $.users[0:2].id
    /users/0/id
    /users/1/id

    What this JSONPath tester refuses

    A query language that quietly guesses is worse than one that says no, because a wrong set of matches looks just like a right one. So the parser here either reads the whole query or reads none of it. When it cannot, the counter on the bar is replaced by a short reason, such as the character it did not expect. The highlights from the last query that could be read stay where they were, because a query being typed is broken at almost every keystroke and a view that emptied at each one would be impossible to type against. The moment the query reads again, the matches follow it.

    The two queries below are refused on purpose. The first is a method call in the style of older JavaScript libraries, which RFC 9535 does not have. The standard does define five functions for filters, length, count, match, search and value, and this subset reads none of them; the shortcut operators above cover the two text functions, which are the ones most people reach for. The second compares each user with a value elsewhere in the same document by starting a second path with the dollar sign. Filters here can only look at the element being tested and at literal values, so a question that joins two parts of a document takes two queries, or an Extract followed by a second query on the result.

    Those limits are the price of a language small enough to type in one line while looking at the data. The subset is named rather than hidden, and the cheat sheet lists every construct it accepts, so a query that works on this page is not an accident that the next version might undo.

    Two queries it refuses

    $.users.length()
    $.users[?@.id > $.meta.id]

    Extract matches as a document

    Highlighting answers a question on screen, but the answer is often needed as data: for a test fixture, a bug report or the next stage of a pipeline. The Extract button on the Find bar writes the current matches into the other pane as a new JSON document. The block below is what the descendant query for id produces from the example. Each match keeps the members and array positions that led to it, so the two user identifiers still sit inside users and the batch label still sits inside meta, while everything else is dropped and the arrays close up around what is left.

    Keeping that outline is deliberate. A bare list of three values would lose the fact that one of them is not a user id at all, and the structure is what lets you tell them apart. The file is named after the original with matches added before the extension, so a later Save or Download is not confused with the source. Because the panes now hold different documents, the editor moves from Mirror to Compare, with the difference colouring off, since a subset differs from its source everywhere. If the other pane already holds work you typed, Extract asks before replacing it, and a query that matched nothing leaves the button unavailable rather than writing an empty object.

    Extract, after $..id

    {
      "users": [
        {
          "id": 7
        },
        {
          "id": 12
        }
      ],
      "meta": {
        "id": "batch-4"
      }
    }

    JSONPath guide and cheat sheet

    This page is built for trying a query quickly on your own data. Two guides go further. The worked guide follows one realistic question from start to finish, filtering a list of orders by their total, stepping through the matches and extracting the result, and explains each part of the query on the way. The cheat sheet runs every supported construct against a single shared document, one row at a time with the matches it returns, which makes it the quickest place to check a piece of syntax you half remember. The examples in both are checked against the same engine as this tester, so they behave on your data exactly as they do there.

    Read Query JSON with JSONPath or keep the JSONPath cheat sheet beside you.

    FAQ

    Frequently asked questions

    Didn’t find your answer?Write to us on the contact page →
    What is JSONPath?

    JSONPath is a small language for naming positions in a JSON document. A path begins at the root, written $, and walks inward by member name, by array index, with a star for every child or with two dots for every level. It was standardised as RFC 9535 in 2024, and this page follows that version where it can.

    How do I test a JSONPath expression?

    Open a file or a sample, then type a path in the Find bar, which this page opens in Query mode. Every node the path selects is highlighted, and the counter says which match is current and how many there are. Enter and Shift+Enter step between them. A path that cannot be read shows a short reason where the counter was.

    How do I find the JSONPath of a value?

    Select the value’s row in Tree view. The bar above the tree shows where that row sits, and Copy path copies the place as JSONPath, such as $.users[3].email, or as JavaScript. A key that is not a plain name, one with a space or a hyphen in it, is quoted for you.

    Can you give some JSONPath examples?

    Three that the article above runs on its example document. $..id finds every id member at any depth. $.users[?@.active == true].name selects the name of each user whose active member is true. $.users[0:2].id takes the id of the first two users, because the end of a slice is left out.

    Which JSONPath syntax does this tester support?

    It supports the site’s named RFC 9535 subset: root and child paths, quoted names, array indexes and slices, wildcards, descendants and filters with comparisons, boolean combinations and existence tests. The article and cheat sheet name the deliberate limits.

    How do I filter with JSONPath?

    Put a question mark inside square brackets to open a filter; the at sign stands for the element being tested, as in $.users[?@.active == true].name. There are six comparison operators, and tests combine with and, or and not. A field on its own passes when it exists and is not false, null or an empty string. Four shortcuts are added: starts with, ends with, contains and a regular expression match.

    Will a JSONPath written for another tool work here?

    Often, but not always. The page follows RFC 9535 where it can, and it still accepts the older form that wraps a filter in round brackets. A method call such as .length() is refused, and so are the five RFC functions: length, count, match, search and value. A refused path shows a short reason, never a guessed set of matches.

    What is the difference between JSONPath and JSON Pointer?

    A JSON Pointer (RFC 6901) names exactly one place in a document, with steps separated by slashes, such as /users/0/name. A JSONPath is a query that can select many places at once. The article above uses both: each example query is a JSONPath, and the matches listed under it are written as JSON Pointers.

    How do I pull data out of a JSON file?

    Open the file, then type a path that names what you want, such as $..id for every id member. The matches are highlighted where they sit. Press the funnel button, Filter to matches, and every row that is neither a match nor on the way to one is hidden, which leaves the answer with its surroundings.

    Can I save the JSONPath matches as JSON?

    Yes. Extract matches into the other pane creates a JSON document that keeps the path around each match. It is an explicit press, so typing a query never replaces either document by itself.

    Why is the JSONPath box already open?

    This page opens the existing Find bar in Query mode so a path can be typed immediately. It does not load a sample, focus the field, change the saved document or remember that mode for another editor page.

    Is my JSON sent to a server?

    No. Parsing the document, reading the path, finding matches and extracting them all happen in this browser tab. Once the page has loaded, the tester continues to work without a connection.