Formatting, validating, and inspecting JSON locally

The JSON Formatter helps developers and analysts turn compact JSON into readable indentation, validate syntax, minify a payload, and inspect a collapsible tree. Parsing occurs in the browser with JavaScript’s JSON implementation. The tool checks JSON grammar, not whether the data matches an API contract, JSON Schema, business rule, or security policy.

How it works

Text from the input panel is trimmed and passed to JSON.parse. A successful format operation serializes the parsed value with two-space indentation and opens a tree view; minify serializes without optional whitespace; validate reports whether the top-level result is an object or array and its immediate item count. Because the text is parsed and serialized, insignificant whitespace disappears and escape representation can change while the represented values remain equivalent. Clipboard buttons rely on browser permission and can fail in restricted contexts.

Steps

  1. Paste a complete JSON value. Use an object, array, string, number, boolean, or null written with valid JSON syntax. Remove JavaScript assignments, comments, trailing commas, and single-quoted property names.
  2. Validate before editing. Run validation and read the parser’s error message. Look near the reported position, but also inspect immediately before it because one missing quote or bracket can shift where failure becomes visible.
  3. Choose readable or compact output. Format for review and version-control discussion, or minify when an API specifically benefits from fewer whitespace characters. Neither action changes an invalid payload into valid JSON.
  4. Inspect and copy deliberately. Expand the tree to confirm nesting and array boundaries, then copy the output. Test the payload against the receiving application or schema before deployment.

Practical use cases

An API developer can expand a minified response while debugging nested arrays, compare fields with documentation, and copy a clean reproduction into a test fixture.

A configuration maintainer can catch trailing commas or mismatched quotes before committing JSON, while still using the project’s own schema validator for allowed keys and values.

Limitations

Syntax validation does not detect unknown properties, wrong units, unsafe URLs, duplicate-key intent, or values that violate an API specification. During parsing, duplicate object names collapse to the last value, and very large integers can lose precision under JavaScript number semantics. Formatting may normalize escapes and numeric notation. Huge payloads can slow or exhaust the tab. The tree is an inspection aid rather than a streaming parser, diff tool, JSON Schema validator, secret scanner, or guarantee that a server will accept the data.

Privacy and file retention

Input, parsed values, and output remain in the current browser tab; this tool does not send JSON to the Toolbox Ninja server. Clipboard paste and copy use browser APIs and place content in the system clipboard, which other applications or clipboard managers may access. Avoid pasting production secrets, tokens, personal records, or private keys on shared or monitored devices, and clear the fields and clipboard when finished.

Frequently asked questions

Why are JavaScript object literals rejected?
JSON is stricter than JavaScript source: property names and strings require double quotes, comments are forbidden, and trailing commas are invalid. Convert the value to actual JSON first.
Can formatting change data?
Whitespace changes are expected. Parsing also applies JavaScript value semantics, so duplicate keys and integers beyond the safe precision range deserve special care.
Does “valid” mean my API will accept it?
No. It means the text parses as JSON. Validate required fields, types, formats, and permissions against the API contract or a JSON Schema separately.