JSON 修复
Turn a JavaScript object literal or a commented config into real JSON, with an itemised list of every change.
关于此工具
Most repair tools fix your document silently, which teaches you nothing and hides the cases where the fix was not what you meant. This one lists every change with its line number, so you can check the result rather than trust it. That matters most for values JavaScript allows and JSON cannot express: NaN, Infinity and undefined all become null, which changes your data rather than just its punctuation. Those are called out separately for exactly that reason. When a document is too broken to rescue, the tool says so and shows the remaining error instead of handing back something that still will not parse. An optional "Extract from surrounding text" toggle looks for the JSON value itself first, inside a Markdown code fence or among ordinary prose, for the common case of pasting a whole chat reply rather than only the part that matters. A document that simply stops partway through, the common shape of a reply cut off by a token limit, is closed rather than rejected: an unterminated string gets its closing quote, and any object or array still open gets its closing brace or bracket, with a value only ever invented for a key that was read but never given one.
使用方法
- Paste the broken JSON into the input pane, or load the sample.
- 点击修复,修复后的文档将显示在右侧。
- Read the list of changes underneath, then copy or download the result.
- Optionally, check "Check against a schema" and paste an OpenAPI or JSON Schema to see whether the repaired result matches it.
- Pasting a whole chat reply rather than just the JSON? Check "Extract from surrounding text" first, so the tool finds the value before repairing it.