Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11For a quick local check, run python -m json.tool input.json: it parses a JSON file and prints readable, indented output if the document is valid. To check whether valid JSON also meets an application’s required structure, validate it separately against the relevant JSON Schema. Formatting, syntax validation, and schema validation answer different questions.
What formatting and validation check
JSON is a language-independent data interchange format, not JavaScript object-literal syntax. RFC 8259 defines its grammar and states that a parser must accept texts that conform to it. A syntax check therefore catches problems such as malformed strings, missing commas, or invalid values; it does not decide whether a value makes sense to a particular application. RFC 8259
- Formatting changes how JSON is laid out so people can read it more easily.
- Syntax validation checks whether the text follows JSON grammar.
- Schema validation checks whether a parseable JSON value meets specified structural and value constraints.
A file can pass the syntax check and still fail its schema—for example, because a required property is absent or a value has the wrong type.
Format and check JSON with Python
Python 3.12.15 documents json.tool as a command-line interface for validating and pretty-printing JSON. Run it from a terminal in the directory containing the file:
Recommended Free Tools
#1 Best Overall
python -m json.tool input.json
If the input parses, the command writes formatted JSON to standard output. If it is malformed, it reports an error rather than producing formatted output. To save the formatted result, redirect standard output to a different file:
python -m json.tool input.json > formatted.json
Keeping the input and output paths separate avoids overwriting the source file while you check the result. The command can also read from standard input and write to an output file; consult the Python 3.12.15 json.tool documentation for its invocation details and options.
Choose output options deliberately
The CLI documents options for indentation, compact output, sorting object keys, and disabling ASCII escaping. Choose these to suit your workflow: compact output is less readable, while sorting keys changes their displayed order. Use JSON Lines mode only for a sequence of separate JSON values, one per line—not for an ordinary JSON document containing one value. The Python documentation describes these options and the JSON Lines mode.
Format JSON in Visual Studio Code
For interactive editing, open the JSON file in Visual Studio Code and run Format Document. The documented keyboard shortcut is Shift+Alt+F on Windows and Linux, or Shift+Option+F on macOS. Formatting improves indentation and layout; it is not a substitute for checking application-specific rules.
Rank #3
VS Code can also provide schema-based checking when the correct JSON Schema is associated with the document. Its bundled JSON support covers schema drafts 4 through 7, with limited support for drafts 2019-09 and 2020-12. You can configure schema mapping in settings or use supported associations. Check the Visual Studio Code JSON guide for the current configuration details and boundaries.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Validate against a JSON Schema when rules matter
Use a schema when you need to enforce expectations such as required properties, allowed value types, or other rules defined for the data. Supply or associate the schema with the JSON instance, then run validation using a schema-aware tool. Choose a validator that supports the draft used by the schema; an editor’s visible feedback depends on its schema association and implementation.
Schema validation is separate from parsing: first ensure the document is valid JSON, then check that it satisfies the expected schema. If the tool reports an error, use the reported location or schema path to find the offending value, correct it, and rerun the same check.
Do not assume the format keyword is enforced
A schema may use format for values such as dates or times, but validators are not universally required to treat that keyword as an assertion. The JSON Schema reference notes that implementations can ignore unrecognized formats, and Python’s jsonschema documentation explains that format checking is not automatically required. If a format rule is important, confirm that the validator supports it and that its format checker is enabled. JSON Schema: format
Quick Recap
Choose a tool based on the data and the check
- Use a local editor for convenient formatting and inline feedback while editing; verify that the intended schema is associated and supported.
- Use Python’s standard-library CLI for a repeatable local syntax check and pretty-printing, including in scripts.
- Use a schema-aware validator when the application imposes structure or value constraints beyond JSON grammar.
- Use an online formatter cautiously: no specific service’s privacy practices are established here. For confidential data, prefer a local tool unless you have checked the service’s data-handling terms.
A practical sequence for reliable results
- Check syntax. Run
python -m json.tool input.jsonor open the file in a JSON-aware editor. Resolve any parse error first. - Format for reading. Use the CLI’s output or VS Code’s Format Document command.
- Check the expected structure. Associate or supply the applicable JSON Schema and run a schema-aware validation.
- Inspect the right error. A syntax error points to invalid JSON text; a schema error points to a mismatch with the expected data rules. Correct the reported issue and rerun the relevant check.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




