My sheet has two columns both called price. Why did one of them get a different name in the JSON?

Because a JSON object cannot hold the same key twice, so if both names stayed identical one value would be lost. The repeated column gets a numeric suffix, so the second becomes price_1, and the tool says so in its notes. The better move is to give both columns clear names in your sheet before converting.

Published · 3 min read

Example: price before and after discount

A product file exported from your inventory program has a SKU column followed by two columns both headed price, the first before discount and the second after:

sku,price,price A1,10,12

Converted to JSON, the tool gave this object:

{"sku": "A1", "price": "10", "price_1": "12"}

Under the output a note appeared: 'Duplicate headers were renamed: price -> price_1'. Both values are kept, but the new name does not tell whoever reads the JSON which one is the discounted price.

What if the name repeats three times?

We tried three columns named price with the values 10, 12 and 9. The keys became price, price_1 and price_2, and the note listed both renames. The numbering follows the column order in the file: the first keeps the original name and the rest take numbers in sequence.

Why the automatic names are not enough

  • The developer or system receiving the JSON usually looks for specific names and will not know that price_1 is the selling price after discount.
  • If a later export changes the column order, the meaning flips: price becomes the discounted price and nobody notices.
  • The note appears once in the tool but is not written into the JSON, so the person who receives the file never sees it.

The cleaner way

  1. Open the file in your spreadsheet and change the two headers to self-explanatory names, such as price_before and price_after.
  2. Save it as CSV, then open or paste it into the CSV and JSON converter with 'CSV to JSON' selected.
  3. Check that the 'Duplicate headers were renamed' note no longer appears.
  4. Copy or download the JSON.

A close cousin: an empty header

If a column has no header at all, you get a different note: 'A column header is empty, so its key is an empty string.' This often happens with a notes column added to a sheet without a name. Same fix: name it before converting.

In the other direction, if the JSON you convert to CSV has an object containing the same key twice, only the last value survives, and the tool warns you with the list of duplicate keys. Nothing is renamed there, because the JSON parser itself keeps only one value.

Common questions

Do I lose any value when a column is renamed?

No. Every column is kept, and repeated ones get a numeric suffix.

Can I choose the suffix?

No, it is added automatically. To pick the name yourself, change the header in the file before converting.

Does renaming happen if I untick 'First row holds column names'?

No. Each row then becomes an array of values without names, so there are no keys to repeat.