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.