How to Query JSON with JSONPath Online

JSONPath is a query language for JSON, similar to XPath for XML. It lets you extract specific values from complex JSON structures without writing custom parsing code. Whether you're working with API responses, configuration files, or data exports, JSONPath makes it easy to navigate nested objects and arrays. This guide shows you how to query JSON with JSONPath using fixie.tools — a free JSONPath tester with syntax highlighting and instant results.

Step 1: Open the JSONPath Query Tool

Navigate to fixie.tools/json-path in your browser. The tool processes all queries locally in your browser with no server uploads, making it safe for sensitive data and providing instant results.

Step 2: Paste Your JSON Data

In the JSON input area, paste or type the JSON you want to query. This could be an API response, configuration file, database export, or any valid JSON structure. The tool validates your JSON syntax and highlights any errors. Use the formatter button to pretty-print your JSON with proper indentation for easier reading.

Step 3: Write Your JSONPath Expression

In the JSONPath query field, enter your query expression. Start with $ to represent the root of the JSON. Use dot notation ($.store.book) to access nested properties, brackets with indexes ([0]) to access array elements, or [*] to select all elements. Common patterns include $.store.book[*].title to get all book titles, $..author to find all author fields at any depth, or $.store.book[?(@.price < 10)] to filter items by condition.

Step 4: View Query Results

The tool displays matching results instantly as you type your JSONPath expression. Results are shown as a JSON array containing all matched values. If your query matches multiple items, all are included in the result array. If nothing matches, you'll see an empty array. The tool highlights the matched portions of the original JSON, making it easy to see what your query selected.

Step 5: Refine and Copy Results

Adjust your JSONPath expression to narrow or broaden your query until you get exactly the data you need. Try different filter expressions, wildcards, and array slices. Once satisfied, copy the results to use in your code, documentation, or other tools. The tool also shows the JSONPath expression you used, which you can implement in your programming language using a JSONPath library.

Frequently Asked Questions

What is JSONPath?
JSONPath is a query language for JSON that lets you extract specific values using path expressions, similar to how XPath works for XML. Instead of writing code to traverse nested objects and arrays, you write declarative queries like $.users[*].email to extract all email addresses from a users array.
What are common JSONPath operators?
$ represents the root element, . is dot notation for child properties ($.store.name), [n] selects array element at index n, [*] selects all array elements, .. recursively searches for properties at any depth, and [?(<expression>)] filters items based on conditions. For example, $.books[?(@.price < 20)] finds books under $20.
Can I filter JSON arrays with conditions?
Yes, use filter expressions like [?(@.property operator value)]. For example, $.products[?(@.inStock == true)] selects products that are in stock, or $.users[?(@.age >= 18)] selects adult users. You can use operators like ==, !=, <, >, <=, >= and combine conditions with && (and) or || (or).
Is the JSONPath tool free?
Yes, Fixie's JSONPath Query Tool is completely free with no signup requirements, no JSON size limits (within browser memory), and no ads. All processing happens locally in your browser for instant results and complete data privacy.
Does JSONPath work in programming languages?
Yes, most programming languages have JSONPath libraries. For JavaScript use jsonpath package, Python has jsonpath-ng, Java has JsonPath, and most other languages have similar libraries. Write and test your queries with Fixie, then implement them in your code using the appropriate library.

Related Tools