ToolsOps

JSON/YAML

Online JSON validator and formatter

Paste your JSON and check it instantly. The tool validates it, formats it with 2 spaces, 4 spaces or a tab, or minifies it to shrink its size. When something is off, the line and column are shown whenever the browser exposes them. Everything runs inside your tab: the text is not sent to a ToolsOps server and is not stored in localStorage.

Load example:

Enter JSON to validate.

Validate and fix JSON online

This tool validates the syntax of any JSON you paste and, if it is valid, formats it with the indentation you pick (2 spaces, 4 spaces or a tab) or minifies it to shrink its size. If it has errors, it shows the line and column when the browser exposes them so you can fix malformed JSON by hand and validate again.

Everything runs in your browser: the payload is not sent to a ToolsOps server, nothing is saved to localStorage, and everything disappears when you close the tab. For depth on JSON Schema, big numbers, YAML anchors and pre-deploy validation, the sidebar links to the JSON and YAML best-practices guide.

Common errors and how to fix them.
ErrorSymptomFix
Trailing commaA comma after the last element of an object or arrayRemove it. Strict JSON (RFC 8259) does not allow it.
// commentLines with // or /* */ break the parserStrip the comment or use JSONC with a dedicated parser.
Unquoted key{ name: "Anna" } failsWrap the key in double quotes: { "name": "Anna" }.
Single quotes{ 'a': 1 } is rejectedSwitch to double quotes: { "a": 1 }.
Unclosed object or arrayMissing } or ] at the end of the documentCount opening vs closing braces. The error usually points at the line where the closer was expected.
Very large integerAn integer larger than 2^53 silently rounds when parsedSerialize it as a string at the source: "id": "9007199254740993". The tool surfaces a yellow warning when it detects one.
Duplicate keyOnly the last occurrence survives formattingRename or consolidate the key. RFC 8259 does not define which value wins.

Validate, format and minify are different operations

The three terms often get mixed up, but they are distinct actions that run in a logical order:

  • Validate checks the JSON against the RFC 8259 grammar - no trailing commas, no comments, keys in double quotes, strings in double quotes.
  • Format (pretty-print) adds line breaks and indentation so humans can read the JSON. It only makes sense once the JSON is valid.
  • Minify strips every bit of extra whitespace and leaves the JSON on a single line - useful for transport or storage. It shrinks the payload without altering the data.

How to fix malformed JSON step by step

This tool does not automatically rewrite invalid JSON. It points you at the first error with its line and column so you can fix it by hand. That is the right operation: automatic fixes often mask real bugs (a tolerated trailing comma can hide a missing property just after it).

  • Paste the JSON into the input field.
  • Read the error message and its position.
  • Fix the problem using the common-errors table on this page as a reference.
  • Hit Format again to verify that it now parses cleanly.

Why client-side JSON validation matters

Traditional online validators upload your JSON to their server. If you paste a payload that contains tokens, API keys or real personal data, those bytes end up in logs, intermediate caches or the provider's database. This tool processes everything inside your tab - no backend, no content telemetry, no storage.

It is an architectural guarantee rather than a marketing promise: the code contains no remote calls that include your input.

Examples

  • {"name":"Anna","age":30,"admin":true}Simple object
  • {"user":{"id":1,"tags":["a","b","c"]}}Nested with array
  • {"data":[{"id":1,"title":"Hello"},{"id":2,"title":"World"}],"page":1,"total":2}Typical API response
  • {"a":1,"b":2,}Invalid - trailing comma error example
  • {"greeting":"Hello, 世界! 🌍"}With unicode

Frequently asked questions

How does this tool validate JSON online?
Paste your JSON into the input and hit Format or Minify. The tool parses it with the browser's `JSON.parse` and, if valid, shows the result. If there are errors, it points to the line and column of the failure (when the browser exposes them) so you can fix it by hand. Everything is client-side.
Does this tool automatically fix malformed JSON?
Not automatically. What it does is flag the first syntax error with its line and column (trailing comma, unquoted key, unclosed brace, single quotes, etc.) so you can fix it yourself. The common-errors table on this page summarizes the symptoms and the fix for each case. The conservative behaviour is deliberate: automatic correction often hides real bugs, like a missing property right after a tolerated trailing comma.
Is my JSON data sent to a server?
No. All processing happens inside your browser. There are no backend calls, nothing is saved to localStorage, and everything disappears when you close the tab. The JSON you paste is not sent to a ToolsOps server; even so, avoid pasting real secrets on shared browsers or untrusted machines.
Why does a large number look different after formatting?
JavaScript represents every number as an IEEE 754 double, so integers larger than 9,007,199,254,740,991 (`Number.MAX_SAFE_INTEGER`) lose precision when parsed. The JSON is still valid - it's not an error - but the tool surfaces a yellow warning about possible precision loss. If you need to preserve very large integer IDs, store them as strings in the source JSON.
My JSON has `//` comments and it errors out. Isn't that valid?
No. The JSON standard (RFC 8259) does not allow comments. What you have is JSONC or JSON5, extended formats this tool does not support on purpose, to avoid ambiguity. Remove the comments or use a JSONC-aware parser.
What's the difference between formatting and minifying?
Formatting (pretty-print) adds line breaks and indentation so the JSON is readable by humans. Minifying strips every bit of extra whitespace so the payload is as small as possible - useful for transport or storage. Both represent the exact same data.
I have the same key "a" twice but the output only shows one. Why?
When an object has duplicate keys, RFC 8259 leaves the behavior undefined. The browser's `JSON.parse` keeps the last occurrence, so only that one survives formatting. This tool validates standard JSON syntax and does not reliably detect duplicate keys: if your API depends on them, it sits outside the standard.
What happens if I paste JSON with tokens or personal data?
If you paste JSON with tokens or personal data, it is processed inside your tab: the content is not sent to a ToolsOps server, not stored in localStorage or cookies, and not included in analytics or page metadata. Still, avoid pasting production secrets on shared browsers, close the tab when you're done, and be wary of browser extensions with access to the page.