How to Format and Validate JSON Online
Diagnose invalid JSON, format it for review, preserve data types, and keep secrets out of pasted payloads.
Start by asking whether the input is actually JSON
Many strings that look like JSON are really JavaScript object literals, log output, or fragments copied from a larger document. Strict JSON requires double-quoted property names and string values, has no comments, and does not allow a trailing comma after the final member.
Validation should happen before you try to 'repair' the payload by hand. A parser error tells you that the document cannot be interpreted as JSON; formatting only becomes meaningful after parsing succeeds.
{
"event": "invoice.created",
"invoiceId": "inv_00125",
"total": 850,
"paid": false
}Read parser errors as location clues
An error near a specific character does not always mean that character is the root cause. A missing quote or bracket earlier in the document can make the parser fail later when the structure becomes impossible to continue. Inspect a small region before and after the reported location.
Frequent causes include single quotes, unquoted keys, trailing commas, mismatched braces, literal line breaks inside strings, and comments copied from configuration examples. If the source came from an API client, also check whether you copied surrounding labels or HTTP output with the JSON body.
- Valid string: "customer" — invalid JSON string delimiters: 'customer'.
- Valid Boolean values are true and false without quotes.
- null is a JSON value; undefined is not.
- Numbers cannot contain currency symbols or thousands separators.
Formatting changes whitespace, not meaning
A formatter parses the input and serializes the same data with indentation so nested objects and arrays are easier to inspect. Minification performs the opposite presentation change by removing unnecessary whitespace. Neither operation should rename keys, coerce strings into numbers, or invent missing values.
This is why validation plus formatting is useful during webhook debugging: you can confirm the payload shape without changing identifiers such as "00125" into 125 or converting date-looking strings into a date type.
Use a small debugging routine
When a large payload fails, first save the original. Remove unrelated top-level branches until you isolate the failing area, or compare the payload with a known-good sample. If a producer controls the payload, fix the serialization there instead of repeatedly repairing downstream copies.
For automation platforms, verify the exact value passed into the failing step. A UI preview may display an object while the next field expects a JSON string, or the reverse. The format of the data and the type expected by the receiving field are separate questions.
Protect payloads before pasting them
JSON often carries credentials, personal records, internal URLs, access tokens, and customer data. Before using any browser utility, remove secrets and replace real values with realistic placeholders unless you have verified the processing model and are permitted to use the data there.
The JSON formatter on WorkflowTools.space uses the browser's JSON parsing functions and does not need a server round trip for formatting or validation. That reduces exposure, but it does not make a shared computer, clipboard history, browser extension, or screen recording safe.
What to verify after the JSON is valid
Syntactic validity only means the document follows JSON grammar. It does not prove that required fields exist, values are allowed, dates are sensible, or the receiving API accepts the schema. Validate business rules separately.
Before using the final payload, compare key names and nesting with the receiver's expected contract, confirm representative values, and test in a non-production environment when the request can create, update, delete, bill, email, or otherwise affect real data.
Frequently Asked Questions
Why can valid JSON still fail an API request?
JSON syntax and an API schema are different checks. A payload can parse correctly while containing missing fields, wrong value types, or unsupported properties.
Related articles
How to Convert CSV to JSON
Convert tabular rows into JSON without breaking quoted commas, headers, leading zeros, or inconsistent records.