JSON Formatter for DevOps: Validate and Debug Configuration Files
Use a JSON formatter to validate and debug DevOps configuration files — package.json, tsconfig, ESLint config, GitHub Actions, and API gateway configs. Catch syntax errors before deployment.
The Problem
Your CI/CD pipeline fails with a cryptic JSON parse error. The error message points to line 47, character 12 of your <code>package.json</code> or <code>tsconfig.json</code>, but you can't spot the issue in your editor. Or your cloud provider's API gateway configuration silently ignores invalid JSON fields — and you discover the misconfiguration only when your API starts behaving unexpectedly in production.
Why This Matters
Modern DevOps infrastructure is defined in JSON: npm package manifests, TypeScript configs, ESLint rules, GitHub Actions workflow triggers, AWS/GCP API gateway configs, Terraform outputs, container registry configurations. A single misplaced comma or unmatched bracket breaks builds, fails deployments, or silently misconfigures infrastructure. JSON validators and formatters are the first line of defense in any DevOps configuration workflow.
Step-by-Step Instructions
Validate your configuration file before committing
Before committing any JSON config file, paste its contents into the JSON Formatter below. If the JSON is invalid, the tool shows the exact error message and line number. This is faster than running npm install or a CI pipeline build only to discover a syntax error 3 minutes later.
Format and normalize indentation
Teams often mix 2-space and 4-space indentation in config files, causing messy git diffs. Format your JSON to a consistent 2-space indent standard. This also reveals structural issues: improperly nested objects, duplicate keys (the formatter shows only the last value for duplicate keys — a common source of confusion in package.json scripts sections).
Audit environment-specific configurations
When debugging environment mismatches (staging works, production doesn't), format both config files and compare them with Text Diff Checker. Formatted JSON diffs are clean and easy to read — every changed field appears on its own line, making it impossible to miss a misconfigured endpoint URL or feature flag.
Inspect API gateway and cloud configuration responses
AWS API Gateway, Google Cloud Endpoints, and Cloudflare Workers often return configuration as minified JSON. When debugging routing rules, CORS settings, or authentication configurations, paste the API response into the formatter to make the structure readable. This is especially useful for large gateway configurations with deeply nested route definitions.
Validate JSON before deployment pipelines
Add a pre-commit hook or CI step that validates critical JSON configs: python3 -m json.tool package.json > /dev/null exits 0 for valid JSON, 1 for invalid. For more comprehensive validation, use ajv (Node.js JSON Schema validator) to check not just syntax but also required fields and value constraints — catching config errors long before they reach production.
Try It Now — JSON Formatter
Open full page →All processing happens in your browser — no data is sent to any server.
Before & After Example
{
"name": "my-api",
"version": "2.0.0",
"scripts": {
"build": "tsc",
"test": "jest",
"deploy": "wrangler publish" // ← JSON doesn't allow comments!
},
"dependencies": {
"express": "^4.18.0",
"prisma": "^5.0.0",
} // ← Trailing comma not allowed in JSON
}
{
"name": "my-api",
"version": "2.0.0",
"scripts": {
"build": "tsc",
"test": "jest",
"deploy": "wrangler publish"
},
"dependencies": {
"express": "^4.18.0",
"prisma": "^5.0.0"
}
}
// Fixed: removed comment, removed trailing comma
// All CI checks will pass now
Frequently Asked Questions
Why doesn't JSON support comments?
JSON was designed as a minimal data interchange format, and comments were intentionally excluded to keep parsers simple and output unambiguous. For config files that benefit from comments, use JSONC (JSON with Comments, supported by VS Code and TypeScript's tsconfig) or YAML instead. Never add comments to production JSON files — parsers will reject them.
How do I validate JSON Schema (not just JSON syntax)?
JSON syntax validation only checks that the file is parseable. JSON Schema validation also checks that required fields exist and values match their expected types. Use ajv (Node.js), jsonschema (Python), or online validators like json-schema.org. Define schemas for your critical config files and validate them in CI.
What's the difference between JSON and JSON5?
JSON5 is a superset of JSON that allows comments, trailing commas, single-quoted strings, and unquoted keys. It's used by some build tools (Babel, Webpack configs) and editors (VS Code settings). Standard JSON parsers cannot parse JSON5. Always check which parser your tool uses before relying on JSON5 features.
Related Workflows
Want the full JSON Formatter experience?
Open the standalone tool for more space, keyboard shortcuts, and additional features.
Open JSON Formatter →