Skip to content
ToolsOnDuty - free online tools
Developer ToolsNovember 6, 2026

How to Convert JSON and CSV Without Losing Track of Data Types

Convert two example records, inspect CSV quoting and compare the reverse JSON output to understand strings, nested values and empty fields.

By ToolsOnDuty Editorial Team

JSON-to-CSV conversion of two example records with commas, quotes and nested data.

JSON and CSV organize information differently. JSON can represent nested objects, booleans, numbers and null values, while a CSV cell is text whose meaning depends on the receiving system. A successful conversion therefore does not automatically mean that a reverse conversion will recover the original types or structure.

This guide uses the ToolsOnDuty JSON to CSV Converter in both directions. We tested two demonstration records, quoted names, leading-zero identifiers, nested data and empty fields. The real screenshots show why comparing the returned records matters more than simply seeing a populated output box.

Start with a representative record array

Open the converter and select JSON to CSV. Our sample contains two objects with identifiers 001 and 002, names containing a comma or quotation marks, boolean active flags and numeric quantities. The first also has a nested details object and a null note; the second omits those fields.

Use synthetic data while testing rather than pasting client records or credentials. Keep the original JSON separately so that conversion can be checked without reconstructing it from CSV. A single object can be treated as one row, but an array of similarly structured objects is a clearer starting point for a tabular export.

Check headers and quoting in the generated CSV

The tested header order was id, name, active, quantity, details and note. The converter collects object keys into the table rather than automatically choosing a business schema. Review that order before importing into a system that expects fixed columns.

Example, North needs quotation marks around its CSV cell because the comma is part of the name, not a separator. The other name's quotation marks are doubled inside a quoted field. These conventions prevent the example names from shifting into extra columns, but they do not validate whether the records themselves are correct.

Two JSON records converted into CSV with correctly quoted comma and quotation-mark characters.
Actual generated CSV. The source area was expanded to show the complete JSON example.
text
id,name,active,quantity,details,note
001,"Example, North",true,2,"{""tier"":""demo""}",
002,"Example ""South""",false,0,,

Switch direction and inspect the returned values

Click CSV to JSON after the successful conversion. The current good CSV result moves into the input automatically. The reverse function uses the first row as headers and returns an object for each following row, with cell values represented as strings.

In our result, active became the string true rather than a boolean, and quantity became the string 2 rather than a number. The identifier 001 remained text with its leading zeros intact in this converter. Do not assume a spreadsheet or another importer will preserve that identifier if it independently guesses numeric types.

Reverse CSV-to-JSON output showing active and quantity as strings and empty note fields.
Actual reverse output: booleans and numbers become strings, while leading-zero identifiers remain textual here.

Handle nested objects, null and missing fields explicitly

The nested details object was serialized as JSON text inside one CSV cell. On the return path it stayed a string containing that JSON text; it was not automatically reconstructed as a nested object. If a downstream application needs nesting, define and validate that reconstruction separately.

The first record's null note and the second record's absent note both became empty CSV cells, then empty strings in the reverse output. That loses the distinction between null, missing and deliberately empty text. Preserve those meanings with an explicit data contract when they affect business logic, rather than relying on a visually blank cell.

Review the table schema before a real import

Use unique, meaningful headers and consistent columns. The reverse function maps cells under their headers; it does not infer a complete schema, validate email addresses or establish primary-key uniqueness. Extra or missing cells should be reviewed before import rather than assumed to match your destination's requirements.

We also tested two rows with the same identifier and confirmed that both were retained. This conversion is not duplicate removal. If deduplication, missing-value rules or row editing are required, use an appropriate CSV-cleaning workflow and record the intended transformations before producing a new import file.

Copy the output without confusing format with safety

The Copy button supplied the exact current CSV output in our test. The interface presents text, not a managed database export job or an automatic upload to another application. Confirm the active direction and field labels before copying, especially after using the reverse mode.

CSV quoting is a format requirement, not a guarantee that arbitrary content is safe in every spreadsheet. Review untrusted fields before opening them in software that may interpret formulas or other special values. The converter does not provide a blanket spreadsheet-safety or business-data validation certification.

Validate errors and compare against the original

Invalid JSON produced an explicit error in our test. Correct syntax first, then compare the actual records, column order, identifiers and intended types. A well-formed output can still be unsuitable for a receiving system that expects a different delimiter, schema or null convention.

The processing runs in the browser, but sharing a copied result is a separate privacy decision. Keep authoritative source data and verify important imports in a controlled process. Do not overwrite a production dataset merely because a small conversion example worked; conversion and a safe import are different operations.

Apply the steps from this guide directly in your browser.

Frequently asked questions

Does CSV-to-JSON infer numbers and booleans?

No. The tested reverse output represented CSV cells as strings, including true and 2.

Will a nested JSON object return as an object?

Not automatically. It is serialized into a CSV cell and returns as JSON text inside a string.

Are null and missing values distinguishable after this round trip?

Not in the tested empty-cell representation. Both became empty strings, so preserve that distinction through an explicit data contract.

Does conversion remove duplicate identifiers?

No. We tested two rows with the same identifier and both remained. Deduplication is a separate operation.