JSON Formatter
Format JSON locally into readable, compact, line-stream, and deterministic outputs with visible dialect controls, node paths, size charts, and duplicate-key checks.Formatted payload
| Metric | Value | Detail | Copy |
|---|---|---|---|
| {{ row.metric }} | {{ row.value }} | {{ row.detail }} |
| Path | Pointer | Type | Detail | Preview | Copy |
|---|---|---|---|---|---|
{{ row.path }} |
{{ row.pointer }} |
{{ row.type }} | {{ row.detail }} | {{ row.preview }} | |
| No nodes match the current filter. | |||||
{{ ndjsonText }}
{{ row.text || ' ' }}
{{ diffStatusText }}
| Section | Note | Copy |
|---|---|---|
| Interoperability checks | Duplicate key findings: {{ duplicateKeys.length }} | |
| Interoperability checks | Unsafe integer findings: {{ metrics.unsafeIntegerCount }} | |
| Interoperability checks | Canonical profile readiness: {{ canonicalReadyLabel }} | |
| Recommended next action | {{ note }} |
JSON is a text format for structured data. It represents strings, numbers, booleans, nulls, objects, and arrays in a form that is readable enough for people and predictable enough for software. Formatting matters because the same data can be written as a compact one-line payload, a readable review draft, or a deterministic string for comparison work.
Whitespace is usually insignificant in JSON, but representation details still affect review and handoff quality. Duplicate object member names can make downstream behavior unpredictable. Large numbers can lose exact integer precision in common browser number handling. A payload that looks tidy can still have hidden structural risk if field paths, node counts, and warnings are not checked.
Line-delimited JSON is a related shape used for one-record-per-line ingestion. It is not the same thing as a single JSON document unless each line is read as its own JSON value. That distinction matters when an array should become a stream of records instead of one compact array.
A formatter should make JSON easier to inspect without inventing meaning. A clean parse proves the text is syntactically valid JSON after the selected draft allowances, not that an API schema, signing system, or application rule will accept the data.
How to Use This Tool:
Start with the next handoff you need, then check the warnings before copying any output.
- Choose
Review workspacefor readable output,Transport payloadfor compact text,Signature canonicalfor sorted no-whitespace text, orCustomwhen the advanced settings should be controlled directly. - Choose
Strict JSONfor production payloads orJSONC commentswhen a draft includes//or block comments that should be stripped before formatting. - Set
Indent spacesandKey orderwhen the visible draft needs a specific review shape or stable comparison order. - Paste one JSON value into
JSON payload, drop text onto the editor, useBrowse JSONto load a local JSON or text file, useSampleto restore the example, or copy the current input for review. - Open
Advancedwhen you need line stream mode, final newline policy, HTML-character escaping, slash escaping, node ledger filtering, or a specific delta target. - Fix any parse error first. The error message includes a line and column when the parser position can be mapped back to the editor text.
- Read the summary headline and warning alert. Duplicate keys, unsafe integers, long numeric literals, large input, and slow formatting each change how much confidence you should place in the output.
- Use
Editor Draft,Wire Payload,Signature Canonical,Line Stream,Node Ledger,Change Delta, charts,Formatter Audit, orJSONdepending on what needs to travel with the result. - When a validation warning remains, fix the producer or source text before using the output for signing, schema validation, or automated ingestion.
Interpreting Results:
The summary headline is a triage signal. JSON Validated and Structured means parsing succeeded without warnings. Valid JSON with Caveats means the output exists, but one or more findings deserve review. Duplicate Key Review Needed is the strongest warning because repeated names can change meaning when another parser chooses which value to keep.
Do not treat Signature Canonical as a full canonicalization certificate. It gives a deterministic local string from the parsed value. Check duplicate-key and unsafe-integer warnings before using it for hash, HMAC, or detached-signature prep, and compare it with any rules imposed by the receiving system.
| Signal | What it means | Verification cue |
|---|---|---|
Duplicates above zero |
The source has repeated object member names before normal parsing can discard ambiguity. | Fix the source producer before signing, validating, or merging the payload. |
Numeric precision risks |
Some numbers may not round-trip exactly through common number handling. | Quote identifier-like integers or high-precision decimals if exact digits matter. |
Wire size badge |
The compact payload differs in byte size from the input source. | Use Payload Size Chart when size change matters for transport or review. |
No Change Delta |
The normalized source matches the selected output at line level. | Still check warnings because a clean text delta is not a schema check. |
Technical Details:
JSON syntax allows any serialized JSON value at the root, including a scalar such as a string, number, boolean, or null. Objects are collections of name/value pairs and arrays are ordered sequences. Whitespace around structural characters can change readability without changing the parsed value.
Object member names should be unique for interoperable behavior. When duplicate names are present, different parsers may keep different values or expose the duplicates differently. That is why duplicate detection has to happen from the source text before the ordinary parsed object loses the repeated-name evidence.
Transformation Core
| Stage | Rule | Review point |
|---|---|---|
| Parse source | The editor text is parsed as one JSON value after optional comment stripping. | Comment stripping helps with draft material, but the output remains standard JSON. |
| Sort keys | Object keys can be preserved, sorted A to Z, or sorted Z to A for the working outputs. | Sorting helps diffs and deterministic comparison but can move fields away from author order. |
| Emit outputs | Readable draft, compact payload, deterministic sorted text, line stream, delta, charts, and JSON diagnostics are derived from the parsed value and selected settings. | Each view answers a different review question; none replaces schema validation. |
| Build ledger | Every parsed node receives a dot-style path, JSON Pointer path, type, detail, and preview. | Use this when field location matters more than the visual shape of braces. |
Formula Core
Wire size delta
A positive reduction means the compact payload is smaller than the editor source. The display rounds the percentage for readability.
| Finding | Rule used | Why it matters |
|---|---|---|
| Duplicate keys | Repeated names in the same object are collected from the source text. | Downstream behavior can be unpredictable when names are not unique. |
| Unsafe integers | Parsed whole numbers outside the exact safe integer range are counted. | IDs and counters can change value after parse and stringify cycles. |
| Precision-heavy literals | Number tokens with more than 15 significant digits are flagged. | High-precision decimals may need to stay as strings. |
| Large input | Input above 5 MB receives a performance warning. |
Rendering, charts, and diffs may be slow on weaker devices. |
| Slow formatting | Refresh time at or above 120 ms receives a runtime warning. |
Very large payloads may be easier to review in chunks. |
After the page has loaded, parsing, file loading, formatting, diagnostics, charting, and exports happen in the browser tab. The page does not run schema checks, business rules, API authentication, or application-specific signing policies.
Worked Examples:
Clean a commented draft
A ticket contains a JSON-like snippet with // temporary note and a small object. Set Input dialect to JSONC comments so it can parse, use Editor Draft for review, and remove the comments from the source before handing the payload to a strict production parser.
Prepare repeatable comparison text
A payload with "b": 2 before "a": 1 can use Signature canonical. The output sorts keys A to Z and removes whitespace. If Duplicate keys is above zero or Canonical readiness is blocked by unsafe integers, fix those findings before using the text for hash comparison.
Build one-record-per-line output
An array such as [{"id":1},{"id":2}] with NDJSON mode set to array mode produces two lines, one JSON value per array item. If the root is not an array, the line stream falls back to one compact line for the whole value.
Trace a field path
For {"items":[{"sku":"A-1"}]}, the Node Ledger gives a path such as $.items[0].sku and a JSON Pointer such as /items/0/sku. Use the ledger when a teammate needs an exact field reference instead of a screenshot.
FAQ:
Does it fix invalid JSON automatically?
No. It reports a parse error and waits for valid input. Formatting starts only after the current text can be parsed.
Is Signature Canonical the same as RFC 8785 canonical JSON?
No. It is a deterministic ascending-key serialization for local repeatability. RFC 8785 has stricter interoperability rules than this page claims.
When does Line Stream create multiple lines?
Array mode creates one JSON value per line only when the root value is an array. Otherwise the page emits the whole value as one compact line.
Why are large integers warned about?
Whole numbers outside the safe integer range may not stay exact after parsing. Quote identifier-like values when every digit matters.
Does the data leave the browser while formatting?
No. After the page has loaded, formatting and diagnostics run in the browser tab, including local file reads, charts, copy actions, and downloads.
Glossary:
- JSON Pointer
- A slash-based standard for pointing to a location inside a JSON value.
- Duplicate member name
- The same object name appearing more than once within a single JSON object.
- Safe integer
- A whole number that can be represented exactly by common browser number handling.
- Line Stream
- The result view that emits one compact JSON value per line when array mode applies.
- Deterministic serialization
- A repeatable text representation that produces the same bytes for the same parsed data and settings.
References:
- The JavaScript Object Notation (JSON) Data Interchange Format, RFC Editor, December 2017.
- JSON Canonicalization Scheme (JCS), RFC Editor, June 2020.
- Number.MAX_SAFE_INTEGER, MDN Web Docs.