CodeCraft

JSON Formatter & Validator

Format, minify, and validate JSON. All processing is done locally in your browser.

✓ JSONC Comments✓ Trailing Commas✓ 100% Local

How to Use

  1. Paste your JSON into the left input box (supports both minified and formatted JSON).
  2. Click Format to generate indented output. Use the dropdown to choose 2 or 4-space indentation.
  3. Click Minify to compress JSON to a single line, reducing transfer size.
  4. Click Validate to check if the JSON syntax is valid.
  5. Click Copy in the output panel to copy the result to clipboard.

About JSON Formatter & Validator

JSON (JavaScript Object Notation) is one of the most important data formats in modern web development. Almost all REST APIs, configuration files, and data stores use JSON. However, unformatted JSON — especially minified versions — is extremely difficult to read and debug. **JSON formatting** expands compressed single-line JSON into an indented, multi-line format that makes data structure immediately visible. **Minification** does the opposite, removing all whitespace to reduce JSON to its minimum size — ideal for API responses and data transmission. **Validation** helps you quickly identify syntax errors in JSON, such as missing quotes, extra commas, or mismatched brackets. This tool additionally supports **JSONC (JSON with Comments) format**, handling TypeScript configurations (`tsconfig.json`), VS Code settings (`settings.json`), and ESLint configs that contain `//` or `/* */` comments. All processing happens locally in your browser — your code and configuration data never leave your device.

Use Cases

API Response Debugging

Paste minified API responses to inspect nested structures and identify missing fields.

Configuration Validation

Validate tsconfig.json, package.json, or ESLint configs before committing to avoid CI failures.

Data Transformation

Format JSON payloads before writing documentation or sharing with teammates.

Learning & Teaching

Visualize complex nested JSON structures when learning about APIs or data modeling.

Examples

Input
{"name":"Alice","age":30}
Output
{
  "name": "Alice",
  "age": 30
}

Minified JSON expanded with 2-space indentation for readability.

Input
{"items":[1,2,3],}
Output
{
  "items": [1, 2, 3]
}

Trailing comma (common in JSONC) is automatically stripped during formatting.

Common Pitfalls & Edge Cases

  • ⚠Trailing commas are valid in JSONC but invalid in strict JSON — this tool handles both.
  • ⚠Single quotes around keys/values are not valid JSON. Use double quotes.
  • ⚠Very large files (>10MB) may cause browser memory issues. Consider using a CLI tool like jq for those.
  • ⚠NaN and Infinity are not valid JSON values — use null or string representations instead.

🔒 Data Privacy

All JSON processing happens entirely in your browser using JavaScript. Your data never leaves your device — no server requests are made.

Standards & References

Frequently Asked Questions

Comments (0)

Leave a comment

0/2000