forgehub. A small, independent toolbox

JSON Mirror

Why won't my JSON compare? A troubleshooting workflow

If JSON Mirror will not compare your documents, check both editor status messages first. Both inputs must parse as JSON and stay within 1,000,000 characters each. Correct syntax before using Format, then compare again. A deeply nested document can parse successfully yet fail during comparison; valid JSON also does not guarantee that your application accepts its contents.

Open JSON Mirror

Start with the editor that failed validation

Paste the earlier document into Original and the later document into Updated. Before interpreting any differences, read the status below each editor. An empty or whitespace-only editor is waiting for JSON; a parsing failure appears as Invalid JSON followed by the parser's error message. Both sides need valid input before Compare JSON can proceed.

When either side fails, selecting Compare JSON announces that both editors need valid JSON and focuses the first failing editor, checking Original first. Correct that side, then check the other. The validation code reads the editor contents without replacing them, so an error does not require you to paste the whole document again.

Remove the wrapper, then fix the syntax

JSON Mirror passes the editor text directly to JSON.parse. Paste the JSON value itself, without a surrounding explanation, Markdown code fence, or JavaScript assignment. For example, paste {"enabled":true}, rather than const config = {"enabled":true};. The app does not extract a JSON fragment from a larger message.

For a small syntax example, {"enabled":true,} has a trailing comma. Remove it to get {"enabled":true}. Likewise, {'mode':'test'} uses single quotes; the JSON form is {"mode":"test"}. Comments inside the pasted document also need to be removed. Fix one issue at a time and reread the status, since the next parsing attempt may reveal another error.

Use the parser message as a clue rather than expecting a dedicated repair wizard. JSON Mirror displays the error message supplied by JSON.parse; it does not add its own highlighted error location or automatically rewrite malformed input. Keep a copy of the original text if you need to track your corrections.

Use Format after the document parses

Each editor has its own Format action. It validates that editor first. If validation fails, it announces the error and returns focus to that editor without formatting. Repeatedly pressing Format will therefore not remove a trailing comma, repair quotes, or strip a copied code fence.

After validation succeeds, Format replaces that editor's text with JSON serialized using two-space indentation. This is useful for inspecting a dense one-line document before comparison. It is a parse-and-serialize operation, so do not use it as a way to preserve the original spelling of every value. The README warns that duplicate keys retain their final value and that JavaScript number precision applies.

Separate size and depth failures from syntax errors

A syntactically correct document can still exceed the input limit. JSON Mirror checks the raw length before parsing and rejects more than 1,000,000 characters in either editor. That is a per-editor character limit, not a combined allowance or a file-size measurement in bytes. Whitespace counts toward it, and the app's Format action cannot process an input already over the limit.

Nesting is checked later, while the comparison engine walks matching containers. Its guard throws an error when traversal depth exceeds 120. This means an editor can show valid JSON while Compare JSON reports that the document is too deeply nested. Parsing success and comparison success are separate steps. For oversized or deeply nested data, compare a smaller relevant portion, while remembering that the result then covers only the portion you supplied.

Do not confuse valid JSON with valid application data

The valid status means the text parsed successfully within the input limit. It does not check required fields, allowed values, or your application's expected types. For example, {"retries":"three"} parses successfully even if your application expects retries to be a number. JSON Mirror has no schema-validation step in this workflow.

Comparing that document with {"retries":3} can reveal the type change, but the comparison cannot decide which version meets your requirements. Use the diff to locate changes, then review those changes against the rules of the system that will consume the document. A matching result answers whether the parsed documents agree, not whether either document is suitable for use.

Run a fresh comparison after every correction

Once both editor statuses are valid, select Compare JSON or press Ctrl/Cmd + Enter. If a previous report is visible, editing either input marks those results stale and disables Export report. Correcting the syntax alone does not refresh that report: you still need a successful comparison.

Finish by reading the new result summary and inspecting the relevant before-and-after values. If comparison fails with a nesting error, the app disables export and puts the error in the summary. Resolve the failure before using any remaining result cards as evidence of the corrected inputs.

AI-assisted ForgeHub editorial. App capabilities were checked against its implementation; this guide is not an independent review.

Frequently asked questions

Can I compare a JSON string or number without an object wrapper?

Yes. JSON Mirror supports root primitives. A quoted string such as "ready", a number such as 42, or null can be the complete input. Plain unquoted text such as ready is not a JSON string.

Why does Format refuse to fix my JSON?

Format validates with the same parser first and returns on error. It indents successfully parsed data; it does not repair malformed syntax or extract JSON from surrounding text.

Why does comparison fail when both editors say valid JSON?

Editor validation checks emptiness, raw character length, and parsing. The comparison engine separately guards traversal depth and can reject deeply nested data after parsing succeeds. Read the comparison error rather than assuming the input needs a syntax correction.

Does the valid status check my configuration's required fields?

No. The status comes from parsing the text, not checking a schema. A document can be valid JSON while containing missing fields, unexpected types, or values your application rejects.