Guide

Validating Data Formats Explained

What it means to validate JSON, YAML, XML, CSV and other data formats — well-formedness vs schema validity, per-format gotchas, and how to fix errors.

Last updated: 26 July 2026

Before any tool, API or pipeline can use your data, it has to be able to read it. Validation is the step that answers “is this data actually in the shape it claims to be?” — and getting it right saves you from cryptic failures deep inside a deploy or a production request. This guide explains what validation really means, the traps hiding in each common format, and how to read the error messages that point you at the fix.

Two very different questions: well-formed vs valid

People say “is my JSON valid?” to mean two different things. Keeping them apart is the single most useful idea in this whole topic.

A quick example. This JSON is well-formed and schema-valid against “a person needs a name string and an age number”:

{ "name": "Ada", "age": 36 }

This is well-formed but not valid against that schema — it parses fine, but age is the wrong type and name is missing:

{ "age": "thirty-six" }

And this is not even well-formed — it never parses, so schema validity is irrelevant:

{ "name": "Ada", "age": 36, }

The order matters: you must be well-formed before schema validity is even a question. Most day-to-day “my config broke” problems are well-formedness failures — a stray comma, a bad indent, an unclosed tag.

Per-format gotchas

Every format has its own small print. These are the mistakes that trip people up most.

JSON

JSON is strict, and that strictness surprises people who write it by hand:

JSON5 and JSONC relax some of these, but standard RFC 8259 JSON does not.

YAML

YAML is whitespace-significant, which makes it readable but fragile:

XML

XML is verbose but has firm rules:

CSV

CSV looks trivial until a value contains a delimiter:

The loose standard here is RFC 4180.

TOML, INI, .env and .properties

These key/value config formats are simpler but still have edges:

Reading error messages

A good validator gives you a line and column for the first error. That location is the fastest route to a fix — the real problem is usually at or just before the reported spot. Some common patterns:

Message hint Likely cause Common fix
“Unexpected token } Trailing comma before it Remove the comma
“Expected , or } Missing comma between items Add the separator
“bad indentation” (YAML) Tab used, or mismatched spaces Replace tabs with spaces
“no element found” (XML) Unclosed or missing root tag Close the tag
“not well-formed (invalid token)” Bare & or < in XML text Escape it (&amp;)

If the reported line looks fine, check the line above it — a missing comma or unclosed quote is often only detected when the parser reaches the next token.

Common validation errors by format

Format Most common validation error
JSON Trailing comma / single quotes
YAML Tabs in indentation, or the Norway boolean trap
XML Unescaped &, or an unclosed tag
CSV Ragged rows from an unquoted comma or quote
TOML/INI Unquoted string values, or duplicate keys
.env/.properties Unquoted values with spaces or special characters

When and where to validate

Validate early and often — the earlier a format error is caught, the cheaper it is to fix:

How CodingSetu validation works

Our Validators check well-formedness entirely in your browser: they parse JSON, YAML, XML, CSV, TOML and more, and report the line and column of the first syntax error. They do not run full schema validation (JSON Schema, XSD) for every format — for schema checks, wire a dedicated validator into your build pipeline.

When a file doesn’t parse, the Repair tools can often fix it automatically — stripping trailing commas and comments from JSON, converting single quotes, closing XML tags, escaping stray characters and re-quoting CSV fields — so you get valid output without hunting for every error by hand.

Because everything runs client-side, your data is never uploaded, which makes it safe to validate secrets, private configs and internal payloads.

References

Try it

Paste your data into the Validators to catch syntax errors with a line and column, then use the Repair tools to fix broken JSON, YAML, XML or CSV — all in your browser, with nothing uploaded.

Frequently asked questions

What's the difference between well-formed and valid?

"Well-formed" means the text parses — the syntax is correct, so a machine can read it (e.g. every JSON brace is matched, every XML tag is closed). "Valid" usually means something stronger: the parsed data also matches a schema that defines which fields must exist, their types and allowed values (e.g. JSON Schema or an XSD). Data can be well-formed but invalid — perfectly parseable, yet missing a required field.

Why does my YAML turn "no" into false?

This is the "Norway problem". The YAML 1.1 spec treats a set of bare words — no, yes, on, off, y, n, true, false — as booleans, so an unquoted country code NO (Norway) becomes false. The fix is to quote the value ("no") so it stays a string. YAML 1.2 narrowed this to just true/false, but many parsers still use 1.1 rules.

Are trailing commas allowed in JSON?

No. RFC 8259 does not allow a trailing comma after the last element of an array or object, does not allow comments, and requires double quotes (not single quotes) around strings and keys. Those are all common reasons valid-looking JSON fails to parse — the Repair tool can strip them for you.

Is my data uploaded when I validate it?

No. Every CodingSetu validator and repair tool runs entirely in your browser. Your data never leaves your device and is never sent to a server, so it is safe to check secrets, config files and private payloads.

Does a validator check my data against a schema?

Our in-browser validators check well-formedness — whether the text parses as valid JSON, YAML, XML, CSV, TOML and so on — and report the line and column of the first syntax error. They do not run full schema validation (JSON Schema, XSD) for every format; for that, use a dedicated schema validator in your build pipeline.

Related tools