Frequently Asked Questions
Common questions about JSON formatting, repair, validation, and data safety.
Frequently asked questions
Can I format invalid JSON online?
Yes. Use Repair & Format when the input is JSON-like, but has common extensions such as single quotes, trailing commas, unquoted keys, comments, or Python-style values. The tool will first attempt to normalize that syntax and then format the result. Use the output after reviewing all fixes.
How do I format broken JSON?
Begin with the smallest sanitized sample that still fails. Correct it, compare the before and after text and run the strict validator. Format is only the way the result is presented after parsing has succeeded; repair is what handles invalid syntax.
What does Unexpected token mean?
The parser found a character that JSON grammar does not allow at that position. The useful clue is the token and its location. A single quote may indicate a JavaScript-style string, / may begin a comment, and an uppercase T may come from Python's True.
Can I convert JSON to a JavaScript object?
Yes. Once the text is strict JSON, JSON.parse(jsonText) returns the corresponding JavaScript value. Do not use eval to parse untrusted data. If the source is a JavaScript object literal with comments, bare keys, or expressions, decide whether you need to execute source code in a controlled build step or convert the data to JSON first.
Is my data safe?
The repair, validation, formatting, and conversion engines run in your browser and do not require the pasted input to be sent to a fixjson.org application server. The page still uses normal hosting and may use analytics, so remove secrets and sensitive production data before using any website. See the Privacy Policy for the boundary in detail.
What is the difference between Repair and Validate?
Repair takes a handful of common non-JSON forms and attempts to produce strict JSON. Validate does not guess, it parses according to JSON rules and reports the first error with line and column. Repair answers “is this well-known syntax normalizable?” Validation answers “is this strict JSON now?
A dependable repair and validation workflow
Most formatters abort at the first parsing failure. JSON Fix is for the step before formatting when the payload came from a log, hand-edited config, Python snippet, JavaScript object literal, or Markdown response and is almost JSON but not quite JSON.
Use this sequence:
- Mask credentials, personal data, and production identifiers.
- Reduce the input to the smallest failing document when practical.
- Run Repair & Format.
- Compare repaired strings, numbers, booleans, and nulls with the source.
- Run Validate on the result.
- Check the valid JSON against your application's schema or API documentation.
Use JSON Minify only after the document is valid and reviewed. A single line is convenient for an environment variable or compact example, while indented JSON is usually better for debugging and code review.
JSON error dictionary
Trailing comma
A comma immediately before } or ] is valid in some programming-language literals but not in JSON. Remove it after the final property or array item.
Missing quotes in JSON keys
Every object key must be a double-quoted string. Convert { name: "Ada" } to { "name": "Ada" }. Quoting a key fixes syntax; it does not confirm that name is an allowed field for your API.
Single quotes
JSON strings use double quotes. When converting 'Ada' to "Ada", preserve apostrophes and escape any double quotes that belong inside the value.
Unexpected token
This family of messages indicates the parser found a character or word that does not belong in the current position of the grammar. Read the location, then check the reported character and the structure immediately preceding it; a missing quote or bracket earlier can make the next valid character look guilty.
Python literals
Python uses True, False, and None; JSON uses true, false, and null. Python dictionaries also permit tuples and non-string keys, which do not have direct JSON equivalents.
Comments
// and /* ... */ comments appear in JavaScript and JSONC but are not part of JSON. If a comment carries operational knowledge, move it to documentation rather than silently losing it during repair.
Markdown code fences
Documentation and AI responses often wrap examples in ````json` fences. Those backticks describe a Markdown code block; they are not part of the JSON document.
Per-tool questions
JSON Fix — How do I repair invalid JSON?
Paste a sanitized sample into JSON Fix and choose Repair & Format. The repair pass handles its supported syntax patterns in one operation, after which you should review and validate the output.
JSON Validate — What is the difference between validating and parsing JSON?
Parsing creates a program value from the text. Syntax validation only needs to know whether that parse succeeds, so it may discard the resulting value. This JSON Validator also formats a successful parse for inspection; it does not apply a JSON Schema.
JSON Viewer — Why is my tree empty?
The JSON Viewer needs a value it can parse. It tries the repair pass after strict parsing fails, but ambiguous or severely malformed text still needs manual correction.
JSON Diff — Why are sorted and unsorted versions reported as identical?
JSON Diff compares object members by key and sorts keys for the line display. Object key order therefore does not create a change, while array order still does.
JSON to TypeScript — Are the generated types validated at runtime?
No. JSON to TypeScript infers interfaces from one sample. TypeScript erases those interfaces at runtime, and a sample cannot reveal every optional field or possible value. Use a runtime validator or schema at the trust boundary.
JSON Minify — Does minification change values?
JSON Minify parses and re-serializes the document without optional whitespace. String contents remain data, including spaces inside quoted strings. Review large integers carefully because JavaScript numbers cannot represent every integer exactly.
JSON Stringify — How do I decode a double-encoded JSON string?
Use Unstringify in JSON Stringify once to recover the inner text. Parse a second time only if that recovered text is itself JSON and you actually need the nested value.
JSON ⇄ CSV — How are nested objects represented?
JSON to CSV serializes a nested object or array as compact JSON inside one CSV cell. The text can be parsed later, but CSV has no standard type metadata, so an exact round trip still depends on how the receiving program treats strings, empty cells, numbers, booleans, and nulls.
JSON ⇄ XML — How do I make a value an XML attribute?
Prefix a key with @, such as @id. The converter stores element text under #text when an element also has attributes or children, and maps arrays to repeated child elements. These are tool conventions, not a universal JSON/XML standard. See JSON to XML.
YAML — Why does my YAML fail to parse?
Indentation is common, but it is not the only cause. Tabs used for indentation, misaligned siblings, malformed flow collections, and unquoted indicator characters can all fail. The YAML tool reports the parser's line and column.
Base64 — What is the difference between Base64 and Base64url?
Standard Base64 uses + and / and commonly retains = padding. Base64url substitutes - and _, and profiles such as JWT commonly omit the padding. Neither form is encryption. See Base64.
URL Decode — Why does my + not decode to a space?
The URL Decode tool follows decodeURIComponent, where + remains a plus sign. HTML form encoding adds a separate convention in which + represents a space. Replace + only when you know the input is form-encoded.
JWT Decode — Does this verify the signature?
No. JWT Decode reads the header and payload without checking the signature. Verify tokens in the system that consumes them, using an established library, trusted keys, the expected algorithms, and checks for issuer, audience, and time-based claims.
Find the right error guide
If you have an exact error string, jump directly to its dedicated article:
- "Unexpected token < in JSON at position 0" → your fetch returned HTML
- "Unexpected token u in JSON at position 0" → you parsed
undefined - "Unexpected token o in JSON at position 1" → an object was stringified to
[object Object] - "Unexpected end of JSON input" → truncated or unclosed structure
- "Unexpected non-whitespace character after JSON data" → extra data after a complete value (NDJSON?)
- "Unterminated string in JSON" → a string opened but never closed
- "Bad escaped character in JSON" → invalid backslash escape such as
\xor an unescaped Windows path - "Bad control character in string literal in JSON" → raw tab/newline/control byte inside a string
- "Expected double-quoted property name…" → trailing comma
- "[object Object] is not valid JSON" → object stringified before parsing
- Not sure which? → start at the overview: How to Fix JSON.parse Unexpected Token Errors
How local processing protects privacy
The repair, validation, formatting, minification and copy actions are running in the browser tab. They don’t need an upload endpoint to handle your JSON. That’s a good limit for API samples, webhook bodies, configuration snippets, and debugging output.
It is not a substitute for data minimization. Hosting and analytics operate around the page as described in the Privacy Policy, and browser extensions or remote resources are outside the tool's control. Replace credentials, access tokens, customer records, and production secrets with safe placeholders before debugging.
What JSON is and why it is strict
JSON is short for JavaScript Object notation, however it is a language agnostic data format. Its small grammar gives browsers, servers, databases, queues and command-line tools the ability to exchange the same document without executing functions, constructors, comments or expressions.
The downside is that a JavaScript object literal, Python dictionary, TypeScript config or Markdown example can look familiar, but not be valid JSON. Repair can fix typical differences but can’t infer missing business meaning.
Before using repaired JSON
A successful repair only means the tool produced parseable JSON. Before using it, make sure the required fields, unknown keys, value types, array lengths, date formats, allowed values, null handling, and whether identifiers should stay strings are correct.
If the payload controls permissions, billing, deletion or customer-visible behavior, check it against a known-good sample or schema. Validate syntax first. Secondly validate the business contract