The useful answer

Use a unique, non-empty header for every CSV column. Format Lab creates one object per data row and preserves CSV values as strings, including leading zeros and decimal-looking text.

Before you start

A CSV-to-JSON conversion changes the structure of a file, but it does not have to guess what each value means. A code such as 001 may be an identifier, and 12.00 may be a formatted label. Automatic conversion to numbers can remove distinctions that matter to the next system.

The practice inventory has three records and a description containing a comma. We preserve all values as strings and use the header names as JSON keys. This makes the transformation predictable. If your receiving system requires numeric quantities, change those types explicitly after deciding which columns are truly numeric.

Your practice file

inventory.csv · Original Deskcraft example · Reusable for practice

Download source ↓

The walkthrough

Check the header names

Load inventory.csv in Format Lab. The header fields are ID, Item and Quantity. Each is non-empty and unique. Duplicate names would make it unclear which cell should become the value of a JSON property.

Choose the source delimiter

Select Comma. The description Pens, blue is quoted in the source, so it remains one field. Do not remove those quotes before parsing; they carry structural meaning.

Select CSV to JSON

Choose that operation and click Convert text. The output should be an array containing three objects. Every object should have the same three named properties as the source header.

Inspect types and values

Find ID 001 in the preview. It should appear inside quotation marks as a JSON string. Quantity 12 is also a string in this conversion. This is intentional preservation, not an arithmetic model.

Save and validate in the next workflow

Download the .json file and open it in a text editor or the receiving application. Confirm it expects an array of records rather than a single wrapper object. Keep the CSV as the source for comparison.

Before & after, in practice

What we checkedStarting comparisonAfter the change
Output66 bytes214 bytes
File extensiontxtjson

Recorded in Chrome 153.0.8010.54. These are measurements of this practice file, not guaranteed results for every file or browser.

Format Lab: Starting comparison for Turn a CSV into JSON without changing your IDs
Starting comparison. Actual Format Lab operation captured with the supplied practice file. Select the image to inspect the settings at full size.
Format Lab: After the change for Turn a CSV into JSON without changing your IDs
After the change. Actual Format Lab operation captured with the supplied practice file. Select the image to inspect the settings at full size.
Inspect the demonstrated result

Download the actual output recorded for this walkthrough.

Download result ↓

When it goes wrong

The tool rejects repeated headers

Rename the columns to distinct, meaningful keys. Silently choosing one repeated name would risk losing a value.

The receiving system wants numbers

Define the numeric columns and transform them deliberately. Do not strip zeros from every value just to satisfy one field.

The output has the wrong number of records

Check for blank lines, embedded line breaks or incorrect quoting in the CSV. A display line is not always one parsed record.

The final check

There should be three objects. The first ID must be the string 001, and Pens, blue must remain a single Item value. Compare each object with its source row before sending the JSON to another system.

Keep one clean original. The tools create a new copy. They do not overwrite your source. For important work, verify the downloaded result in the application that will actually use it.

Further reading & method

These links explain the underlying formats or browser behavior. The steps, examples, screenshots and measured results above come from the Deskcraft tools. Screenshots do not depict Excel, Photoshop or another commercial application.

See how these guides are made. Found an error? Send a correction with the guide title and the step you tried.