A config file is the most dangerous place in a project to have a syntax error, because nothing about the error looks dangerous. You edit the file, add a setting, leave a trailing comma after the last value. The editor saves without complaint. The deploy runs without complaint. The file only gets read when the application starts, at the worst possible moment, and then it either fails to start or, worse, quietly falls back to defaults.
The check that prevents this takes seconds and costs nothing. This guide shows how to validate the exact file before it ships with the free JSON Formatter and Validator on Ovatly, and how to read a failure correctly, because one class of failure means your file is broken and another only means it follows a different standard.
Contents
- Quick answer
- Why config files are the worst place for a syntax error
- Strict JSON, JSONC and JSON5: know which one your file is
- How to validate a config file before deploying, step by step
- Worked example: one config, two different failures
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Before deploying, paste the exact config file that will ship, not a copy from memory, into the JSON Formatter and Validator and run Validate only. The validator checks the text without changing it and names any problem in plain words: fix what it names, in your editor, and validate again until the file comes back clean. One judgement call comes first: this validator applies strict JSON, so comments and trailing commas always fail here. If your config is written for a system that reads JSONC or JSON5, that failure is expected behaviour, not a bug. Know your file's standard, then let the check do its work.
Why config files are the worst place for a syntax error
Most files get read constantly, so errors surface quickly. A config file gets read rarely and at the worst times: at startup, after a deploy, during a restart in the middle of an incident. The person who made the edit is often not the person watching it fail, and the error blames the application, not the comma you added last Tuesday.
Some systems make it quieter still, treating an unreadable config as an absent one and starting with built-in defaults. The deploy looks successful, the service runs, and the settings you thought you shipped are simply not in effect. A thirty-second validation before the deploy is the only point in that chain where the error is cheap.
Strict JSON, JSONC and JSON5: know which one your file is
Strict JSON is unforgiving about four things that people naturally write: comments are not allowed, a trailing comma after the last value is invalid, strings must use double quotes rather than single quotes, and keys must be quoted. The validator on this page applies exactly that standard.
Lenient variants exist because config files invite comments. JSONC and JSON5 both allow comments, and JSON5 also allows trailing commas, single-quoted strings and unquoted keys. So a commented config pasted into this validator will fail, and that failure has two possible meanings. If the system reading your config expects strict JSON, you have caught a real bug before it shipped. If the system reads JSONC, the file is fine and the validator is simply stricter than your runtime.
Neither meaning is available until you answer one question: which standard does the reading system actually implement? Check its documentation once, write the answer down for your team, and every result after that is unambiguous.
How to validate a config file before deploying, step by step
- Take the exact file that will ship, opened from the location it deploys from, not a copy from a chat message, a ticket or another folder.
- Open the JSON Formatter and Validator and paste the file in.
- Run Validate only. The check leaves your text untouched and either passes the file or names the problem.
- Fix what the error names, in your editor, then paste the corrected file and validate again. A parser reports the first problem it cannot pass, so repeat until the result is clean.
- Deploy the file you validated. If anything edits it after this point, even one line, validate the new version too.
- Optional: format a copy with a 2 or 4 space indent to eyeball the structure, but ship the original text. Number precision follows JavaScript, so a config carrying integers beyond 2^53, such as long generated IDs, can lose exactness when reformatted; Validate only never rewrites anything.
Worked example: one config, two different failures
Start with a small, valid config:
{"name":"Ovatly","tools":250,"free":true}
It validates cleanly, and formatted for reading it looks like this:
{
"name": "Ovatly",
"tools": 250,
"free": true
}
Now the version someone actually ships after a quick edit:
{
"name": "Ovatly",
"tools": 250,
"free": true,
}
The trailing comma after true makes this invalid strict JSON. The validator names the problem; delete the comma, validate again, and the file passes. If the application reads strict JSON, you have just prevented a broken deploy.
A different edit produces a different lesson:
// site settings
{"name":"Ovatly","tools":250,"free":true}
This also fails here, because comments are not allowed in strict JSON. But the fix is not automatic. If the target system reads JSONC, the comment is legal and the file needs no change; if it reads strict JSON, the comment has to go. Same validator, same red result, opposite conclusions, decided entirely by which standard the config follows.
Limitations and honest tradeoffs
Validation checks syntax, not sense: it cannot tell you that a value is wrong, a key is misspelled in a way that still parses, or a required setting is absent. A valid config can still be a wrong config, and this step does not replace your normal testing after a deploy.
The strictness cuts both ways, as the worked example shows: the validator will reject files that a lenient runtime would happily read. That is a limitation if you treat every failure as a defect, and a feature if your runtime is strict, because then the check matches the real gate. Very large pastes may take a moment to check. The one unqualified benefit is privacy: the tool is fully local and nothing is uploaded, so a config full of internal details never gets sent to a third-party server.
Common mistakes
- Validating a different copy than the one deployed. A clean result for your laptop copy says nothing about the file on the server. Validate the exact artifact that ships.
- Treating a JSONC failure as a bug. A comment failing strict validation is expected if your system reads JSONC; establish the standard first.
- Reformatting the config and shipping the formatted version. Reformatting rewrites numbers with JavaScript precision; long integers can change. Validate only, ship the original.
- Fixing the named error and shipping without re-validating. The first error hides any behind it; the file is ready when a fresh paste validates clean.
- Reading a pass as proof the settings are right. Syntax is one layer; values, keys and required settings still need their own checks.
FAQs
Will Validate change my config file in any way? No. Validate only checks the text without changing it. What you paste is what gets checked, and the file you deploy stays byte for byte what you validated. Formatting is a separate action, and for config files you usually want validation only.
My config has comments and the validator rejects it. Is the file broken? Not necessarily. Comments are not allowed in strict JSON, and this validator applies the strict standard. If the system reading your config uses JSONC or JSON5, comments are legal there and the file may be fine. Check which standard your config follows before you strip anything out.
What kinds of errors does validation catch? The syntax problems a strict parser can name: a trailing comma, a missing comma, an unexpected character, single-quoted strings, unquoted keys and comments. The error names the problem in plain words, so you fix that one thing and validate again.
Is my config file uploaded anywhere when I validate it? No. The check runs locally in your browser and nothing is uploaded, which matters for config files: they routinely contain internal hostnames, feature flags and environment details you would not want in a server-side checker.
Does a valid result guarantee my config will work? It guarantees the file is valid strict JSON, nothing more. Validation checks syntax, not whether the values are right for your application. A perfectly valid config can still point at the wrong database. Catch the syntax errors here; test values the way you always have.
Conclusion
Validating a config file is a small habit placed at the one moment it helps: after the last edit, before the deploy. Run the exact file through the JSON Formatter and Validator with Validate only, interpret any failure against the standard your config actually follows, and ship the text you checked. When the failure is structural rather than a stray comma, our companion guide on missing brackets and braces, the most common JSON errors walks through the level-by-level count that finds it. For more guides in this series, see our Data and JSON Tools guides.
References
- JSON.org, introducing the JSON format and its grammar: https://www.json.org/json-en.html
- MDN Web Docs, on JSON syntax and working with JSON: https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON