Data Format Converters — CSV, JSON & YAML
Bidirectional conversion between the three formats that data actually arrives in.
2 tools · Reviewed by Mimamsa, Founder & Engineer, CodeLint.Dev
CSV, JSON and YAML each win in a different place — CSV comes out of spreadsheets and databases, JSON moves between services, YAML is what configuration is written in — and so data constantly has to cross between them.
The conversions are not symmetric, and that is where the difficulty sits. CSV is flat and untyped: every value is text, and nesting has to be flattened into column names. JSON is nested and typed but has no comments and no anchors. YAML has both, plus significant indentation and a type-inference system famous enough to have a name — the Norway problem, where the unquoted country code NO is parsed as the boolean false.
These converters handle the parts people get wrong by hand: quoted fields containing the delimiter, embedded newlines inside quoted CSV values, type inference that can be turned off when you want everything to stay a string, and nested-to-flat key mapping in both directions.
Converters
Which format for which job
| Use case | Format | Why |
|---|---|---|
| Tabular data from a spreadsheet or database | CSV | Flat, universally importable, tiny |
| API request and response bodies | JSON | Nested, typed, parsed natively everywhere |
| Hand-edited configuration | YAML | Comments and readable multi-line strings |
| Config generated by a program | JSON | No type-inference surprises, faster to parse |
| Config read at a trust boundary | JSON | YAML parsers can construct objects from untrusted input |
| A very large dataset streamed line by line | JSON Lines | One complete JSON value per line — parse without loading it all |
Frequently asked questions
- How is a CSV field containing a comma handled?
- It is wrapped in double quotes, per RFC 4180 — the comma inside quotes is data, not a delimiter. A literal double quote inside a quoted field is escaped by doubling it. The parser here follows the same rules, so round-tripping a value like: She said "hello", then left — survives unchanged.
- Why did my YAML value change type after conversion?
- YAML infers types from unquoted scalars, and the inference is aggressive. Unquoted yes, no, on, off, true and false all become booleans; NO as a country code becomes false, and version numbers like 1.20 become the number 1.2, dropping the trailing zero. Quote any value whose exact textual form matters.
- Can nested JSON be converted to CSV?
- Yes, by flattening: nested keys become dotted column names, so {"user":{"id":7}} becomes a column named user.id. Arrays of differing length across rows do not flatten cleanly and are the one case where a manual decision about the target shape is unavoidable.
- Why do leading zeros disappear from my data?
- Type inference is converting a digit string to a number, which destroys postcodes, product codes and zero-padded identifiers. Turn inference off so every field stays a string, then convert only the columns you know are numeric.
- Is my data uploaded?
- No. Both converters run in your browser. Nothing is transmitted, so it is safe for exports containing customer records or internal identifiers, and it keeps working with the network disconnected.