---
title: JSON Formatter & JSONPath Tester
description: Free JSON formatter, validator and JSONPath tester. Beautify or minify JSON with precise error locations, then query it with JSONPath and see every match — 100% in your browser, nothing is uploaded.
canonical: https://watchfor.io/json-formatter
---

[Back to all free tools](/free-tools)

# JSON Formatter & JSONPath

Format, minify and validate JSON with precise error positions, then test JSONPath expressions against your document and see every match. WatchFor API monitor assertions use a simpler dot path (checks.0.name rather than $.checks[0].name), so rewrite brackets and wildcards before pasting a path into one. Runs entirely in your browser; your data never leaves the page. Free, no signup.

[How to use this tool](/blog/how-to-format-and-query-json)

JSON document Format Minify Sample Clear

{
"service" : "api-gateway" ,
"status" : "healthy" ,
"checks" : [
{ "name" : "database" , "ok" : true , "latency_ms" : 4 },
{ "name" : "cache" , "ok" : true , "latency_ms" : 1 },
{ "name" : "queue" , "ok" : false , "latency_ms" : 973 }
],
"version" : "2.14.1"
}
{
"service": "api-gateway",
"status": "healthy",
"checks": [
{ "name": "database", "ok": true, "latency_ms": 4 },
{ "name": "cache", "ok": true, "latency_ms": 1 },
{ "name": "queue", "ok": false, "latency_ms": 973 }
],
"version": "2.14.1"
}

Valid JSON · 262 bytes ( 206 minified)

JSONPath query

$.status $.checks[*].name $.checks[0].latency_ms $..ok $.checks[-1]

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](/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.

Can I paste these paths into a WatchFor API monitor? Simple ones, yes: $.status and $.data.name work as written, because the monitor drops the leading $. Brackets and recursive descent don't: the monitor uses GJSON paths, so write $.checks[0].name as checks.0.name and $.checks[*].name as checks.#.name. There is no equivalent of $..name.

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 fields in the JSON body (dot paths such as checks.0.name), and alert you the moment a response stops matching.

[Start monitoring for free](/pricing)

Free plan · 15 monitors · no credit card required

---

Canonical page: https://watchfor.io/json-formatter · Site guide: https://watchfor.io/llms.txt
