Article

CSV to JSON Case: Preserve Duplicate Columns and Leading Zeros

Reproduce a two-row CSV conversion with duplicate headers, reserved suffixes, quoted commas, line breaks, and leading-zero IDs. Download the exact input and browser output.

jsoncsvdeveloper-toolsapi

The problem we reproduced

A CSV file can contain two columns named label and a third named label_2. Renaming the second label to label_2 seems reasonable until it overwrites the column that already owns that name. This is a data-loss problem even when the downloaded JSON parses correctly.

On September 6, 2026, we used the two-row fixture below to test AscendLab's converter. The former duplicate-header logic could overwrite a value. The corrected logic reserves existing header names before choosing suffixes. This case records the corrected browser download, not just a proposed output.

Exact input

The downloadable source includes a line break inside the last quoted cell. IDs are intentionally strings with leading zeros; the data is synthetic and contains no customer records.

id,label,label,label_2,note
001,first,second,keep,"comma, inside"
002,next,last,reserved,"line one
line two"

Reproduce the conversion

  1. Open CSV to JSON Converter.
  2. Paste the source, select comma as the delimiter, and leave the first-row header option enabled. Leave nested keys disabled for this case.
  3. Check the duplicate-header warning. The second label becomes label_3, because label_2 is already reserved by the source.
  4. Download JSON. Open the downloaded file and verify two objects, five properties per object, and string IDs 001 and 002.
[
  {"id":"001","label":"first","label_3":"second","label_2":"keep","note":"comma, inside"},
  {"id":"002","label":"next","label_3":"last","label_2":"reserved","note":"line one\nline two"}
]

The exact downloadable output uses indentation. The compact display above has the same keys and values. The quoted comma stays inside one cell, the quoted newline stays inside one string, and the generated suffix does not replace a source column.

What we checked

An automated Chrome session entered the exact text through the public tool interface on the release candidate and clicked Download JSON. We inspected that file against the expected two objects. Separate regression fixtures also cover reserved nested paths and scalar/object collisions. These checks establish this conversion behavior; they do not establish compatibility with every spreadsheet dialect.

With nested keys enabled, a header such as account.name asks the converter to create an object. A simultaneous account column is ambiguous: it cannot be both a scalar and an object. The converter now reports that conflict instead of silently replacing a value. Reserved prototype path segments are also rejected in nested mode.

Before using the result as a fixture

Use JSON Formatter to inspect the output, but keep identifiers as strings. Turning 001 into the number 1 changes its meaning. If you need numeric prices or booleans, convert those known fields deliberately in the receiving application.

Formatting does not anonymize source data. Replace private values in your own editor, compare versions with Diff Checker, then run the receiving test. A structurally valid JSON file can still contain the wrong units or business values.

If your CSV has a mismatched number of cells or an unclosed quote, correct the source first. Do not remove quotes merely to make the error disappear: that can split a single note into multiple columns. See the converter reference for the accepted dialect and nested-key limits.

Download the case files

Synthetic samples and actual browser exports from September 6, 2026. Keep the original when comparing results.

Related docs

Related tools