JSON Toolkit

Format Conversion

Converting between JSON and YAML, XML, CSV, TypeScript, Java, Go, and SQL is never lossless. What matters is being explicit about where the loss happens.

8 articles

Articles in this category

Converting JSON to and from CSV and Tabular Data

CSV is two-dimensional, JSON is tree-shaped. The hard part of conversion is not the code — it is deciding up front how arrays get flattened and how types are preserved.

Beginner~10 min readUpdated 2026-10-30

JSON to YAML on the Command Line: Four Traps Behind One yq Command

The most-copied command in every tutorial, yq -P input.json > output.yaml, still emits JSON on yq v4. This article benchmarks yq 4.44.6, PyYAML 6.0.3 and js-yaml on a 2.39 MB sample, explains why the input extension decides the output format, and gives correct recipes for batch conversion, quoting, indentation and big-integer precision.

Intermediate~9 min readUpdated 2026-11-03

JSON to CSV: Where Headers Come From and Why Values Change

Nine experiments against a real converter: the first-row-keys strategy silently drops fields, null/missing/empty all collapse into blank cells, a 20-digit integer loses precision at JSON.parse time, and dot-collision flattening merges two different keys into one column. How headers are built, which values mutate, and how to pick a strategy by downstream use.

Intermediate~6 min readUpdated 2026-11-04

JSON to Java Class: The Generator Gives You a Skeleton, Production Needs Five More Things

A hands-on look at what a JSON-to-Java generator really emits — numbers become Double, nested objects become static inner classes, and not a single Jackson annotation is produced. Money precision, field renaming, type erasure, unknown fields, and dates are the five things you must add yourself, with copy-paste code for each.

Advanced~10 min readUpdated 2026-11-04