JSON Formatter
Format JSON, extract fields by JSON Pointer and review JSON Patch operations. Inspect each change and download the result when every operation passes.
Still loading. If the tool doesn’t appear, reload this page.
Related features and workflows
- JSON Patch Review and Replay
Available now
About this tool
JSON Formatter
Regular formatted display of JSON, plus automatic formatting/conversion for API interface testing (GET, POST, POST-JSON).
This JSON formatter validates and indents raw JSON. It also converts GET query strings and URL-encoded POST form bodies into JSON objects. Choose 2, 4 or 8 spaces or a tab for indentation, sort keys, and copy or download the formatted JSON. Open a local JSON file or paste text. Invalid JSON shows its error location. In either JSON mode, extract a selected value by JSON Pointer and copy or download it separately.
How to use JSON Formatter
In Regular Formatter or API POST JSON, use Open JSON file to load a file from your device, or paste a JSON value into the input.
Choose one of the four mode cards — Regular Formatter, API GET Test, API POST Form or API POST JSON — and fill the input panel it opens: Raw JSON Input, GET Target URL (placeholder https://api.example.com/v1/search?q=query...) or POST Form Payload (placeholder key1=val1&key2=val2). Load Sample drops a worked example into whichever panel is showing, and each mode also starts with one pre-filled.
Formatted Result JSON updates as you type. Set Tab Size to 2 Spaces, 4 Spaces, 8 Spaces or Tab. In the GET and POST modes, edit the Parameters Editor rows to update the URL or form body. Turn on Sort keys A–Z to sort text keys. For invalid JSON, use the reported line and column to find the problem.
Use Copy above the result, or Download, which saves the formatted JSON as api_payload_regular.json, api_payload_get.json, api_payload_post.json or api_payload_postJson.json depending on the mode you are in. The output header shows output.json with a live line and character count, and Clear empties every input field.
Why use JSON Formatter
Three input formats
Open a local JSON file, paste a value to format it, or turn a GET query string or URL-encoded form body into a JSON object.
Two-way parameter table
Edit a key or value in the table and the URL, form body or JSON text is rewritten to match, so you never hand-edit percent-encoding.
Errors with a line and column
When the input is not valid JSON, the result names the line and column where parsing stopped and shows that line with a marker under the problem, such as a trailing comma or a single-quoted string.
JSON Lines and JSON arrays
Convert up to 10,000 records in either direction. The tool skips blank lines, reports malformed records by physical line number, and keeps large and precise numeric values.
Extract a value by JSON Pointer
Enter a path such as /items/0/id to select a nested value. Exact large numbers remain exact in the extracted JSON.
Copy or download the result
The output panel shows the formatted JSON and its line and character counts. Copy the text or save it as a JSON file.
Common use cases
- You copied a long GET URL out of a browser network tab and want its fifteen query parameters as a readable JSON object instead of one unbroken string
- Convert newline-delimited records to a JSON array for editing, then export one JSON value per line again while preserving large numeric IDs.
- A minified API response landed in your terminal as one line and you need it indented at your team's four-space setting before you can find the field you are debugging
Frequently asked questions
Does this actually send the API request?
No. The GET, POST-form and POST-JSON panels build and display what the request would look like — method, target, headers and body — but nothing leaves your browser. Use it to prepare and check a payload, then paste it into your own HTTP client.
Link to answerWhat indentation options are there?
Four: 2 spaces, 4 spaces, 8 spaces, or a literal tab character. The same setting drives both the formatted output and anything the parameter table writes back into the JSON panel.
Link to answerHow does it convert a query string into JSON?
Paste a URL with query parameters into API GET Test. The tool decodes the parameters into JSON keys with string values. A parameter like tag=pdf&tag=json keeps its last value, json. Encode literal question marks as %3F inside values and remove any URL fragment before pasting.
Link to answerWhy does my JSON fail to parse?
Almost always because it is JavaScript rather than JSON: trailing commas, single-quoted strings, unquoted keys, comments and `undefined` are all valid in a JS object literal and all rejected by JSON. The result panel names the line and column of the first problem, says what was expected there, and shows that line with a ^ marker under the spot.
Link to answerCan it sort the keys alphabetically?
Turn on Sort keys A–Z to sort text keys inside objects at every level. Keys that JavaScript treats as array indices, such as 2 and 10, appear in numeric order. Array items keep their original order.
Link to answerDoes formatting round large or precise numbers?
Regular Formatter and API POST JSON preserve numeric values when formatting, including 1.0000000000000001, 9007199254740993 and 1e400. Editing a different parameter row preserves the number precision and value types of untouched rows. Use Raw JSON Input for non-object POST payloads, including arrays and scalar values.
Link to answerHow do I extract a value from a JSON file?
Open JSON file, then open Extract a value with JSON Pointer. Enter /items/0 to select the first element in an items array. Use ~1 for a slash and ~0 for a tilde within a key. Extraction follows the formatted output, which keeps the last value of any repeated key in the same object.
Link to answerCan I extract selected fields from a JSON array?
Yes. Open Extract fields from an array. Enter an array pointer such as /records, or leave it empty for a top-level array. Give each field an output name and a pointer such as /address/city. The result keeps the original record order and exact numbers, and uses null for missing values. Copy or download it as JSON.
Link to answerDoes it warn about duplicate keys?
Yes. JSON.parse silently keeps only the last value when a key appears twice in the same object, so the result panel lists any repeated keys above the output.
Link to answerHow do I convert JSON Lines to a JSON array?
Open Convert JSON Lines, paste one JSON value per line or open a .jsonl or .ndjson file, then select Convert. Download the JSON array or use the output as input to convert back. The tool supports up to 10,000 records and keeps large numbers exact.
Link to answer