A JSON formatter online can turn an unreadable API response into a structure you can inspect, but formatting alone will not explain every failure. This checklist shows how to pretty-print large payloads, validate syntax, trace malformed values, and review arrays, escaped characters, and null values without losing the original response.
Overview
JSON, or JavaScript Object Notation, is a text format commonly used to exchange structured data between browsers, applications, APIs, webhooks, and automation systems. A compact response may be efficient to transmit, yet difficult to read when it contains several nested objects or long arrays. A json formatter online or JSON prettify tool adds indentation and line breaks so the hierarchy becomes visible.
Formatting and validation are related but different tasks. A formatter improves presentation when the input is valid. A validator checks whether the text follows JSON syntax and usually reports where parsing failed. If a response cannot be formatted, start with validation rather than repeatedly changing indentation settings.
Use browser-based developer tools for low-risk, non-sensitive payloads. Do not paste access tokens, passwords, personal data, private keys, payment information, or confidential customer records into an online utility unless your organization has explicitly approved that workflow. For sensitive data, use a local editor, a command-line parser, or an internal tool.
Valid and invalid JSON compared
| Input | Status | Why |
|---|---|---|
{"status":"ok","items":[1,2,3]} | Valid | Keys and string values use double quotes, the array is closed, and commas are correctly placed. |
{"status": "ok", "items": [1, 2, 3]} | Valid | Whitespace is optional, so this is equivalent to the compact example. |
{'status':'ok'} | Invalid | JSON strings must use double quotes, not single quotes. |
{"status":"ok",} | Invalid | JSON does not allow a trailing comma before an object closes. |
{"items":[1,2,3} | Invalid | The array begins with [ but closes with }. |
Checklist by scenario
When you need to format a valid API response
- Copy the complete response body, beginning with the first opening brace
{or bracket[. - Paste it into a JSON formatter online or a local JSON editor.
- Choose a readable indentation level if the tool provides that option. Two spaces is a common choice for compact readability; consistency matters more than the exact number.
- Scan the resulting tree from the top level downward. Identify metadata, nested objects, arrays, error fields, and pagination fields before examining individual values.
- Save or copy the formatted version only when you need it for review. Keep the original response available for comparison, because formatting changes whitespace but should not change data.
For example, this compact response:
{"user":{"id":42,"name":"Asha","roles":["editor","reviewer"]},"active":true}
becomes easier to inspect when displayed as:
{
"user": {
"id": 42,
"name": "Asha",
"roles": [
"editor",
"reviewer"
]
},
"active": true
}
When the formatter reports a syntax error
- Read the reported line and column, but also inspect the few characters immediately before that position. Parsers often detect a problem after the actual mistake.
- Check that every opening brace, closing brace, opening bracket, and closing bracket has a matching pair.
- Check commas between properties and array items. Remove commas immediately before a closing brace or bracket.
- Replace single-quoted keys or values with double-quoted JSON strings.
- Inspect strings containing quotation marks, backslashes, line breaks, or copied control characters.
- Validate the smallest failing section you can isolate, then add surrounding objects back until the error returns.
This last step is especially useful for a large webhook or log payload. Make a copy, remove unrelated top-level fields, and test the reduced document. Binary search through the payload—removing roughly half at a time—can locate a malformed section faster than reading thousands of lines.
When you are checking nested arrays and optional values
Arrays are ordered lists and can contain objects, strings, numbers, booleans, or other arrays. Confirm that the application expects the actual shape. An endpoint that returns "items": [] has a valid empty array; it does not necessarily indicate an error. Likewise, null is a valid JSON value and is different from an omitted property, an empty string, or an empty object.
{
"avatar": null,
"description": "",
"preferences": {},
"tags": []
}
These four values communicate different states. Before changing them, check the API documentation or schema. If you are comparing two responses, note whether a field is absent in one response or explicitly set to null in both.
When escaped characters look wrong
Escaped characters are often valid even when they look unfamiliar. A quotation mark inside a string may appear as ', a backslash as \\, and a line break may be represented by \n. Do not remove escape characters manually unless you understand whether you are viewing the raw JSON text or a value that has already been parsed once.
Double encoding is a common source of confusion. If a property contains a string that itself looks like JSON, such as "payload":"{'id':42}", the inner value is a string, not a nested object. The receiving application may need an additional parse step, but that is a data-model decision rather than a formatting problem.
What to double-check
- Root type: Confirm whether the response should begin with an object or an array. Both can be valid JSON, but client code may expect one specific shape.
- Property names: JSON object keys are strings and require double quotes. Check spelling and capitalization when a client cannot find a field.
- Data types: A number, boolean, string, null, array, and object are not interchangeable. The string
"false"is not the booleanfalse. - Encoding: If text appears corrupted, verify the response encoding and transport layer before editing the JSON. Formatting cannot repair bytes that were decoded incorrectly.
- Response boundaries: Check that the body contains only JSON. Server warnings, HTML error pages, stack traces, or log prefixes can make an otherwise valid payload fail validation.
- Schema expectations: Syntax validation confirms that the text is JSON; it does not confirm required fields, allowed values, authentication state, or business rules. For contract checks, use an appropriate schema or OpenAPI validation workflow. See the OpenAPI validator guide for a related approach.
Common mistakes
Confusing JavaScript with JSON: JavaScript object literals may use unquoted property names, comments, or single quotes. Those conveniences are not part of standard JSON syntax.
Fixing the formatted copy instead of the source: A prettified response is useful for diagnosis, but changing it does not fix the server, request, webhook, or database process that produced it. Record the endpoint, request parameters, status code, and response headers separately.
Assuming a valid document is a correct response: A parser can accept {"message":"ok"} even when your application requires an id and an items array. Follow syntax validation with structural and semantic checks.
Ignoring content outside the visible payload: Copying from a browser console or terminal can include prefixes, quotation marks added by a logging layer, or truncated output. Compare the copied text with the raw network response when possible.
Pasting secrets into public tools: Redact bearer tokens, cookies, signed URLs, credentials, and personal information before using browser-based developer tools. A JWT may be readable when decoded, but its claims and signature-related data can still be sensitive. For token-specific checks, use a controlled workflow such as the one described in the JWT decoder guide.
When to revisit
Keep this checklist nearby whenever you inspect a new API, compare webhook deliveries, troubleshoot an integration, or review a response after a deployment. Revisit the workflow when an endpoint changes its response shape, a client library is upgraded, a schema gains nullable fields, or an integration begins returning unexpected arrays or error objects.
Before acting on a formatted response, run this short final check:
- Is the payload safe to process in the tool you selected?
- Does it pass JSON syntax validation?
- Are braces, brackets, commas, quotes, and escape sequences correct?
- Are arrays, null values, missing fields, and data types consistent with the expected contract?
- Have you separated formatting from schema, authentication, and application-level debugging?
- Can you reproduce the response from the original request or event?
If the payload is still unclear, preserve the raw response, create a minimal reproducible example, and compare it with a known-good response. Formatting exposes structure; careful validation and comparison reveal what changed.