<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: JSON2CSV</title>
    <description>The latest articles on DEV Community by JSON2CSV (@json2csv).</description>
    <link>https://dev.to/json2csv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4268790%2F034e5f6c-3043-4585-9caa-462fa0a9dd5f.png</url>
      <title>DEV Community: JSON2CSV</title>
      <link>https://dev.to/json2csv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/json2csv"/>
    <language>en</language>
    <item>
      <title>Why Excel Breaks Your JSON-to-CSV Conversions (and How to Stop It)</title>
      <dc:creator>JSON2CSV</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:17:16 +0000</pubDate>
      <link>https://dev.to/json2csv/why-excel-breaks-your-json-to-csv-conversions-and-how-to-stop-it-1ie1</link>
      <guid>https://dev.to/json2csv/why-excel-breaks-your-json-to-csv-conversions-and-how-to-stop-it-1ie1</guid>
      <description>&lt;p&gt;I have lost count of how many times someone has said "the converter is broken, half my IDs are wrong" when the CSV was actually fine. The file was correct. Excel changed it when it opened it.&lt;/p&gt;

&lt;p&gt;After running into this enough times, I built a browser-based converter that avoids the traps below. This post is about the traps themselves, because you will hit them whatever tool you use.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Excel keeps only 15 digits
&lt;/h2&gt;

&lt;p&gt;Excel stores numbers as 64-bit floating point, so it shows 15 significant digits and replaces the rest with zeros. A 19-digit order ID like &lt;code&gt;1234567890123456789&lt;/code&gt; opens as &lt;code&gt;1234567890123450000&lt;/code&gt;. The CSV still holds the right value, but if you save from Excel you overwrite it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What to do:&lt;/strong&gt; treat IDs as text, never as numbers. In CSV you cannot mark a column as text, so either import through Excel's Data &amp;gt; From Text/CSV and set the column type to Text, or export to &lt;code&gt;.xlsx&lt;/code&gt; where the cell type is stored.&lt;/p&gt;

&lt;p&gt;JSON has a similar problem one step earlier. &lt;code&gt;JSON.parse&lt;/code&gt; in JavaScript also uses 64-bit floats, so an integer above 9007199254740991 is rounded before your code ever sees it. If your IDs are that large, ask the API to send them as strings, or use a parser that keeps the original digits.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Leading zeros disappear
&lt;/h2&gt;

&lt;p&gt;A zip code like &lt;code&gt;02134&lt;/code&gt; becomes &lt;code&gt;2134&lt;/code&gt;. Phone numbers lose their leading zero too. Same cause: Excel decides the column is numeric and drops the zero. Same fix: import as text.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Accents turn into garbage
&lt;/h2&gt;

&lt;p&gt;If &lt;code&gt;Müller&lt;/code&gt; appears as &lt;code&gt;MÃ¼ller&lt;/code&gt;, the CSV is UTF-8 but Excel opened it as a legacy Windows encoding. Writing the file with a UTF-8 byte order mark (BOM) fixes it, because Excel then detects the encoding. In Python that is &lt;code&gt;encoding="utf-8-sig"&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Everything is in one column
&lt;/h2&gt;

&lt;p&gt;In many European locales, Excel expects a semicolon as the CSV separator because the comma is the decimal mark. A comma-separated file then lands in column A. Either use a semicolon delimiter for those users or import with an explicit delimiter.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Nested JSON has no single right answer
&lt;/h2&gt;

&lt;p&gt;CSV is flat and JSON is not. When a record contains an object, the usual answer is to flatten it into columns like &lt;code&gt;address.city&lt;/code&gt;. When it contains a list, you have to choose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One row per list item&lt;/strong&gt;, repeating the parent values. Good for analysis, but row counts grow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The list in one cell&lt;/strong&gt;, joined with a separator. Good for display, harder to filter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Numbered columns&lt;/strong&gt; such as &lt;code&gt;tags.0&lt;/code&gt;, &lt;code&gt;tags.1&lt;/code&gt;. Works only if lists are short.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these is wrong. The mistake is not choosing on purpose.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Not every JSON file is JSON
&lt;/h2&gt;

&lt;p&gt;Log exports are often JSON Lines (one object per line, no outer brackets). A normal parser rejects the whole file. Read it line by line, and report the bad lines instead of stopping at the first one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tool
&lt;/h2&gt;

&lt;p&gt;I put all of this into a converter that runs entirely in the browser, so your data is never uploaded: &lt;strong&gt;&lt;a href="https://json2csv.online/" rel="noopener noreferrer"&gt;JSON2CSV.online&lt;/a&gt;&lt;/strong&gt;. It flattens nested data, keeps long IDs and leading zeros as text, reads JSONL, and writes Excel-friendly CSV or &lt;code&gt;.xlsx&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you prefer code, these guides have the details and snippets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://json2csv.online/json-to-csv-python/" rel="noopener noreferrer"&gt;JSON to CSV in Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://json2csv.online/jq-json-to-csv/" rel="noopener noreferrer"&gt;JSON to CSV with jq&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://json2csv.online/json-to-csv-javascript-node/" rel="noopener noreferrer"&gt;JSON to CSV in JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://json2csv.online/excel-csv-long-numbers-leading-zeros/" rel="noopener noreferrer"&gt;Why Excel changes long numbers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is a small project and I am still finding rough edges. If you have a file it gets wrong, tell me in the comments and I will look at it.&lt;/p&gt;

</description>
      <category>json</category>
      <category>csv</category>
      <category>excel</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
