How the JSON / XML Inspector Works
A plain-language explanation of JSONPath and XPath querying, how the browser parses structured data, and why this tool processes everything locally on your device.
What this tool does
The JSON / XML Inspector lets you paste a JSON or XML document, then validate it, format it, and query it using a path expression — JSONPath for JSON, XPath for XML. Results are shown immediately as you type.
This is useful when you need to extract a specific value from a large API response or configuration document without writing a script or installing a command-line tool.
How JSON mode works
In JSON mode, the tool parses your input using the browser's built-in JSON.parse, then evaluates your JSONPath expression using the jsonpath-plus library. Both steps happen in the browser — no server is involved.
The library runs entirely in JavaScript and implements the JSONPath specification with several extensions, including recursive descent, filter expressions, and script expressions. Query results are serialised back to JSON for display.
JSONPath syntax primer
JSONPath expressions describe a path through a JSON document. Common syntax:
$— the root of the document..key— select a child by name (dot notation).["key"]— select a child by name (bracket notation, required for keys with special characters).[N]— select the Nth element of an array (zero-indexed).[*]— select all elements of an array or all values of an object...— recursive descent: search the entire subtree for matching nodes.[?(@.price < 10)]— filter expression: select elements matching a condition.
Example: $.store.book[*].author selects all author fields from every book in the store object.
How XML mode works
In XML mode, the tool parses your input using the browser's built-in DOMParser with the application/xml MIME type. This is the same parser the browser uses internally — no external library is needed.
XPath queries are evaluated using document.evaluate, a standard Web API available in all modern browsers. Results are extracted from the XPathResult and serialised using XMLSerializer for display.
XPath syntax primer
XPath expressions select nodes in an XML document using a path-like syntax. Common patterns:
/root/child— selectchildelements directly underroot(absolute path from the document root).//element— select allelementnodes anywhere in the document (recursive).@attr— select an attribute.[N]— select the Nth matching node (one-indexed).[@id='foo']— filter by attribute value.text()— select the text content of a node.count(//item)— count allitemnodes.
Example: //book[@category='fiction']/title/text() selects the text of every title element inside a book with category="fiction".
How browser-based processing works
All parsing and querying happens inside your browser tab using JavaScript and built-in Web APIs. Your input is not sent to our servers. The tool makes no network requests to process your data.
For JSON: JSON.parse + jsonpath-plus (a bundled JavaScript library). For XML: DOMParser + document.evaluate + XMLSerializer (all native browser APIs). Nothing leaves your device through this tool.
Why local processing matters
Structured data you inspect during debugging often contains sensitive content: API responses with user records, internal service payloads, configuration documents with credentials, or XML feeds from internal systems.
Local processing means that data stays in your browser tab. It is useful for privacy-conscious debugging workflows where routing content through a third-party server would be inappropriate — for example, querying a production API response, extracting values from an internal config file, or inspecting an XML document received from a customer.
Common use cases
- Extracting fields from API responses — use a JSONPath expression to pull a specific nested value out of a large API response during debugging, without writing a script.
- Querying XML configuration — use XPath to select specific elements or attributes from application config, SOAP responses, or RSS/Atom feeds.
- Validating document structure — check whether a JSON or XML document is well-formed before sending it to another system.
- Counting or filtering nodes — use XPath functions like
count()or JSONPath filter expressions to quickly answer questions about a document's contents. - Learning path syntax — experiment with JSONPath or XPath expressions interactively against a real document to understand how they work before adding them to code.
Frequently asked questions
Is my data sent to a server?
No. All parsing and querying runs locally in your browser. Your input is not transmitted to our servers.
What is the difference between JSONPath and XPath?
JSONPath is designed for JSON documents and uses a dot-and-bracket syntax modelled on JavaScript property access. XPath is designed for XML documents and uses a path syntax based on the XML tree model. They are not interchangeable — use JSONPath for JSON and XPath for XML.
Does XPath support XML namespaces?
The tool uses the browser's native document.evaluate without a namespace resolver, so namespace-prefixed XPath expressions (e.g. ns:element) may not resolve correctly. For namespace-heavy documents, use local-name predicates such as //*[local-name()='element'] as a workaround.
Does this tool work offline?
Once the page has loaded, parsing and querying run locally and do not require a network connection. You do need to be online to load the page initially.
What is the maximum input size?
There is no hard limit enforced by the tool. The practical limit depends on your browser's available memory. Large documents (several megabytes) are generally handled without issue, though very large documents may slow down interactive querying.
Can I verify that no data is sent?
Yes. Open your browser's developer tools, go to the Network tab, and observe that no requests are made when you paste input or run a query. The source code is also open for inspection.
Explore more tools
JSON Formatter & Validator
Validate, pretty-print, and minify JSON with friendly error messages. Runs entirely in the browser.
EncodingBase64 Encode/Decode
Encode and decode Base64 strings, with optional gzip compression. Supports UTF-8.
AuthJWT Inspector
Decode and inspect JSON Web Tokens. View header, payload, and claims with human-readable timestamps.
Ready to try it?
Query JSON with JSONPath and XML with XPath, directly in your browser.