UtilityPilot.Find a tool

Data & Tables · PRACTICAL GUIDE

Convert nested JSON to CSV without hidden data loss

Understand object flattening, arrays, missing fields and numeric precision before exporting JSON as a table.

A table needs a row boundary

The converter accepts an array of objects, with each object becoming one row. If an API response wraps records inside a results property, extract that array first. A single object can be wrapped in square brackets. An empty array provides no fields to use as a table schema.

Follow the flattening rule

[{"id":"00123","address":{"city":"Lahore"},"tags":["writer","editor"]}]

With flattening enabled, address.city becomes a column. The tags array stays JSON text in one cell. It does not create two rows. With flattening disabled, the address object also stays JSON text.

If the same record contains both a literal key address.city and a nested address object with city, flattening would create a collision. The converter blocks that case so one value cannot overwrite the other.

Some distinctions cannot survive

Missing fields and explicit null both become empty cells. A CSV also does not carry a rich type schema. Consequently, converting back to JSON cannot reliably reconstruct the original structure or null/missing distinction. Arrays stay serialized, but a downstream spreadsheet may still alter their quoting or values on save.

JSON number tokens are kept as text during conversion, so 9007199254740993 is not rounded by the browser. The receiving application must also preserve it; import identifier columns as text.

Choose and inspect columns

Fields are collected across all records in first-seen order. Use optional one-based column positions to select or reorder the output, then inspect the header and a few rows. CSV quoting protects embedded separators and newlines. Formula-like cells are prefixed in spreadsheet-safe mode.

Validate JSON first when a syntax error prevents conversion. A valid syntax result still says nothing about whether the chosen array contains the business records you intended.

When flattening is the wrong choice

Do not flatten when the destination expects nested JSON back, when parallel arrays imply a relationship that flattening would destroy, or when a literal key already contains a dot that would collide with a path. Do not flatten deeply nested documents into hundreds of sparse columns; extract the relevant array first after inspecting it in JSON Viewer.

Also skip flattening when arrays of objects should become child tables—CSV is one table per file. Export related arrays separately or keep them serialized and join downstream in a system that supports relations.

Precision and type pitfalls

JSON number tokens are kept as text during conversion so 9007199254740993 is not rounded by the browser—but a spreadsheet that opens the CSV may still round it. Import identifier columns as text. Dates become strings; the receiving system’s date parsing is authoritative. Booleans become true/false text unless the destination expects 1/0 or TRUE/FALSE.

Null and missing both become empty cells. If the destination distinguishes them, CSV is the wrong intermediate format—pass JSON through or use a system that preserves null explicitly.

A complete conversion checklist

1) Validate JSON syntax. 2) Confirm the root is a nonempty array of objects (wrap a single object). 3) Decide flatten on/off and check for dotted-key collisions. 4) Choose delimiter and spreadsheet-safe prefixing. 5) Select or reorder columns with one-based positions. 6) Convert and inspect the header plus first rows. 7) Check that identifiers still have leading zeros after any spreadsheet round-trip. 8) Keep the original JSON beside the CSV.

If any step fails, stop and fix that step—do not chain another conversion on top of a doubtful intermediate file.

Put it into practice

Choose the tool that matches your next step. Keep an original copy and inspect the result before using it elsewhere.

JSON to CSV converterTurn object records into spreadsheet-ready rows.Data & TablesJSON formatter and validatorMake JSON readable and identify syntax errors.Data & TablesCSV viewer and validatorInspect a file before importing it.Data & Tables