Guide · JSON & Data
How to Format and Validate JSON From an API Response
Updated 2026-08-12 · 4 min read
A network panel copy is usually one line. You need to see whether it is JSON at all, then read data.items[2].sku without squinting. That is formatting and validation. It is not a brand name, and it is not a schema linter.
JSON Formatter on DevOkk.com pretty-prints and tells you if the text parses. The work happens in the browser. There is no account. If the payload might contain a token or a customer email, treat any website as hostile until proven otherwise - and still prefer a local-in-tab tool over an upload form.
What pretty-print actually solves
Validation is the first question. JSON.parse either accepts the string or it does not. A formatter is a readable JSON.parse. If the paste has a trailing comma after the last property, a ' where a " belongs, or a undefined that JavaScript objects allow and JSON does not, the job stops until you fix the text.
Pretty-print is the second question. Indentation does not change the value. It changes whether you can see the value. A 12 KB webhook on one line is valid and still useless. Two-space indent is enough. Do not argue about tabs in a paste tool.
What formatting does not solve: wrong types ("true" versus true), missing fields, or a 200 that is an HTML error page with a { in it. The formatter will reject the HTML. It will happily accept a well-formed object that is the wrong shape for your client.
The syntax problems a formatter will catch
These show up constantly in copied responses and hand-edited fixtures:
- Trailing commas.
{"ok": true,}is JavaScript. It is not JSON. - Single quotes.
{'sku': 'A-104'}looks fine in a Python REPL. JSON requires double quotes. - Unquoted keys.
{sku: "A-104"}is an object literal, not JSON. - Comments.
// debugand/* */are not in the JSON grammar. Some configs pretend they are. - Truncated paste. You selected from
{through half of an array. The formatter fails closed. Good. - Concatenated values.
}{or two objects in one box is not one document. NDJSON is a different format.
If the error is one of those, stay on the formatter until the text is a single value. Jumping to a viewer or a minifier first just moves the same failure.
For a longer catalog of breaks and what they look like in a real paste, read How to Fix Invalid JSON.
Keep the payload in the tab
Production access tokens, refresh tokens, and PII-ish exports should not be pasted into random websites. Browser-local is the safer default: DevOkk’s formatter processes the text in your tab to complete the task. That is not a Faraday cage. Pages still load over the network. Analytics still exist. The relevant difference is that finishing “make this pretty” does not require uploading the body to complete the job.
If the response includes Authorization leftovers or a user email you did not notice, redact after you format, or use a dummy payload. Dummy data first is still the conservative habit.
A messy network-panel paste
You copy a POST response. It looks like this on one line:
{"ok":true,"requestId":"req_9f2","data":{"items":[{"sku":"A-104","qty":2},{"sku":"B-220","qty":0}]},"errors":[]}
Paste it into JSON Formatter. If it parses, you get indentation and you can see that items[1].qty is 0. If someone had left a trailing comma after "errors":[], the formatter stops and you fix that comma before you do anything else.
A second common paste is a curl dump that still has the HTTP headers above the body. The formatter will reject HTTP/1.1 200 OK. Delete the headers. Keep the { through the matching }.
A third is a pretty-printed object that is actually a JavaScript literal from a test file: unquoted keys, single quotes, a trailing comma. That is not an API failure. It is the wrong dialect. Convert it to JSON by hand or regenerate it from JSON.stringify in a console you control.
After it parses
Formatting is often step one of a short chain, not the whole hour.
If the document is large and you need one path, open JSON Viewer and expand only that branch. If you are writing a fixture, redact, then minify with JSON Minifier. If the source was never JSON - SOAP, a spreadsheet, a YAML config - convert first, then come back to the formatter.
Do not paste the same customer export into four different websites for those four steps. That is how a five-minute debug becomes four copies of a payload you would not put in Slack.
What a formatter will not fix
It will not infer a schema. It will not coerce "12" into 12. It will not merge two truncated copies into one document. It will not decode a JWT sitting in a string field - that is a different tool. It will not replace jq in a pipeline that runs 40,000 times a night. Use a script you own for that.
Very large dumps can exhaust tab memory. Sample the file. Invalid UTF-8 and binary pretending to be JSON will fail. When the tool cannot read the text, that is a stop sign, not a prompt to upload it somewhere shadier.
Open the formatter
Open JSON Formatter with a non-sensitive sample. Confirm it parses, copy the pretty result if you need it in an editor, and stop. If you outgrow pretty-print in five minutes, use the viewer. If the text will not parse, use the invalid JSON guide. The rest of the toolkit sits under JSON tools.
Frequently asked questions
Does JSON Formatter require an account?
No. Paste the response, format it, copy the result, close the tab. Registration is not part of the workflow.
Does DevOkk upload the JSON I paste?
JSON Formatter is designed to process the text in your browser. You still load the page like any other site; the payload is not sent to complete formatting or validation.
Should I paste a production API body?
Avoid pasting live tokens, session cookies, or customer PII into any website if policy forbids it. If you must inspect a payload, a browser-local formatter is the safer default.
What does validate mean here?
It means the text parses as a single JSON value: object, array, string, number, boolean, or null. It does not mean the schema matches your OpenAPI file or that field types are what the backend intended.
The formatter says it is invalid. What next?
Read the error, fix trailing commas, single quotes, or truncated copy-paste, then format again. For a catalog of common breaks, see the invalid-JSON guide. DevOkk is not a full IDE refactor.
When should I switch to the viewer?
After the document parses and you need a path, not more whitespace. Pretty-print is for reading a small object. A tree is for a large one.
Related guides
More reading that links back to the same tools and workflows.
How to Fix Invalid JSON (Commas, Quotes, and Trailing Junk)
Common parse errors and a local formatter once it is valid.
4 min read
Best JSON Tools for Developers
Format, view, minify, and graph JSON in the browser. A privacy-first toolkit for API debugging without pasting secrets to a site.
5 min read
Why XML to JSON Looks Wrong (Attributes, Text, and Arrays of One)
XML is a document tree. JSON is typed values. Why converters invent `#text` keys, wrap singles in arrays, and drop namespaces - and how to inspect the result locally.
7 min read
Why CSV to JSON Keeps Failing (Quotes, Excel, and Encoding)
Trailing commas, European separators, UTF-8 BOM, and quoted commas. How to get a JSON array without uploading a customer export.
13 min read