Skip to content
FmtTools

Format converters

Convert tabular and hierarchical formats both ways

Conversion between JSON, CSV and YAML is where data actually gets lost, because the two formats disagree about everything that is not a string: CSV has no types, no nesting and no escape for a field that contains the delimiter unless you quote it, and YAML assigns types by a set of implicit rules that changed between version 1.1 and 1.2. Each page here shows the decisions it is making instead of hiding them, so a zip code that turns into 12345 is visible at conversion time rather than after the import.

4 tools in this column

Questions people ask before converting

Why does my CSV import produce the wrong number of columns?

Splitting on a comma is only correct when no field ever contains a comma, which RFC 4180 §2 lists as a permitted case: a field containing the delimiter MUST be enclosed in double quotes, and a field may also contain line breaks and quotes inside that enclosure. A quoted field with an embedded newline spans several physical lines, so a line-by-line split gives ragged rows. These converters read character by character with the enclosure state tracked, and report rows whose field count differs from the header.

Is it safe to let the converter guess column types?

It is safe when the guess is reported, which is what these pages do: every column that coerces shows its inferred type and how many values failed the rule. The dangerous cases are identifiers with a leading zero, 15-plus-digit numbers that exceed the 2^53 − 1 exact-integer limit, ISO dates a spreadsheet reformats, and anything starting with =, + or @ that a spreadsheet evaluates as a formula. Leaving inference off and treating every cell as a string is the correct default for a migration.

Which converter should I use to move a Kubernetes manifest?

YAML to JSON first if you want to see how the file actually resolves — that page lists every scalar whose resolved type depends on the spec edition, and expands anchors and merge keys, which is the only way to catch a replicaCount: 010 becoming 8 through octal interpretation. JSON to YAML going the other way quotes the values a 1.1 parser would reinterpret, so country codes and version strings stay strings.

Read next