JSON Formatter & JSONPath
Format, minify and validate JSON with precise error positions, then test JSONPath expressions against your document and see every match — the same syntax WatchFor API monitors use for response assertions. Runs entirely in your browser; your data never leaves the page. Free, no signup.
Valid JSON· 262 bytes (206 minified)
3 matches
"database""cache""queue"
JSONPath syntax cheat sheet
| Expression | Selects |
|---|---|
| $ | the whole document |
| $.status | a top-level field |
| $['content-type'] | a key with special characters |
| $.items[0] | first array element ([-1] = last) |
| $.items[1:3] | array slice (elements 1 and 2) |
| $.items[*].id | one field from every element |
| $..id | every id, at any depth |
Testing an API end to end? Run a one-off request with the free API tester — it makes the request from our probes and shows status, headers and body.
Frequently asked questions
Is my JSON uploaded anywhere?
No. Formatting, validation and JSONPath evaluation all run in your browser with JavaScript — nothing you paste here is sent to our servers or anyone else's. You can verify this in your browser's network tab: no requests fire when you format or query.
What is JSONPath?
JSONPath is a query language for JSON, analogous to XPath for XML. $ is the document root, dots and brackets navigate into it: $.checks[0].name takes the name of the first item in the checks array. Wildcards ($.checks[*].name) and recursive descent ($..name — any depth) let one expression pull values from anywhere in the document. It's the standard way monitoring tools, API tests and low-code platforms reference response fields.
Which JSONPath syntax does this tester support?
Root ($), dot and bracket children ($.a, $['a b']), array indexes including negative ($[0], $[-1]), slices ($[1:3]), wildcards ($.* and $[*]) and recursive descent ($..price, $..*). Filter expressions like $[?(@.price > 10)] are not supported — implementations disagree wildly on their semantics, so we'd rather not pretend.
Why does my JSONPath return no matches?
The usual suspects: forgetting the $ root ($status instead of $.status); using a dot for a key that contains spaces or dashes (use $['content-type'] instead of $.content-type); querying an array without an index or wildcard ($.checks.name instead of $.checks[*].name); or case differences — JSON keys are case-sensitive.
How do I find the exact location of a JSON syntax error?
Paste the document and the validator reports the line and column of the first character it couldn't parse. The most common errors are trailing commas after the last item, single quotes instead of double quotes, unquoted keys, and comments — none of which strict JSON allows (they're JSON5/JSONC extensions).
Does JSON allow comments or trailing commas?
Strict JSON (RFC 8259) allows neither. Trailing commas, comments, single quotes and unquoted keys come from looser dialects — JSON5, JSONC (what VS Code settings use), or plain JavaScript object literals. If a config file needs comments, the file format has to explicitly support JSONC; an API returning them is broken.
What's the difference between JSONPath and jq?
JSONPath is a compact query language for selecting values; jq is a full transformation language with pipes, functions, arithmetic and restructuring. For "give me this field" — JSONPath. For "reshape this document into another" — jq. API monitoring assertions almost always need the former: select a value, compare it against an expectation.
Same JSONPath, but against your production API — every minute
WatchFor API monitors call your endpoints on schedule, assert on status, headers and JSONPath expressions like the ones you just tested, and alert you the moment a response stops matching.
Free plan · 15 monitors · no credit card required