How to Fix Broken JSON and Convert It to a Spreadsheet

JSON from an API or an export usually arrives as one enormous line, and a small hand edit is enough to break it. This guide covers formatting JSON to find errors, turning it into a table you can open in a spreadsheet, and the garbled text and mangled numbers that often appear along the way.

Updated: 2026-11-20

The syntax mistakes that break JSON

JSON looks like JavaScript but is far stricter. The usual culprits are a trailing comma after the last item, strings in single quotes, property names without quotes, comments such as //, and values JSON does not have, such as undefined or NaN. Strings and property names must use double quotes, and the only allowed values are strings, numbers, true, false, null, arrays and objects.

JSON copied out of a word processor or chat app sometimes has its straight double quotes replaced with curly ones. They look almost identical, but to a JSON parser they are different characters, so parsing fails. If an error keeps appearing in the same place after you fix it, check the shape of the quotes.

Check the structure with Format & validate JSON

Format & validate JSON reads your input with the browser's standard JSON parser and, if it succeeds, shows it neatly indented. If the syntax is wrong you get an error instead, and depending on the browser the message may point to the position of the problem.

One caution: JavaScript represents integers exactly only up to 2 to the power of 53, about 9 quadrillion. Order numbers or IDs longer than that, stored as unquoted numbers, can have their last digits changed during formatting. Keep values that must stay exact as strings.

  1. Paste the JSON into the input box. Input is supported up to 2 MB.
  2. Under Indentation, choose 2 spaces or 4 spaces, or Minify if you want the smallest output.
  3. Choose Convert. If an error appears, check the commas, quotes and bracket pairs near the reported position, fix them and try again.
  4. Copy the formatted result or download it as json-format.json.

Turn JSON into a table

To view JSON in a spreadsheet, the data needs to be an array of objects, like [{"name":"Alice","age":30}, ...], where each object becomes a row and each property name becomes a column heading. Wrap a single object in square brackets to make it an array. If the whole response is wrapped in another layer, such as {"data": [...]}, paste only the inner array.

JSON → CSV collects the property names from every object to build the columns and leaves a cell empty when an object lacks a property. Nested objects and arrays are not expanded into columns; they go into a single cell as JSON text. Values beginning with characters such as =, +, - or @ could run as spreadsheet formulas, so the tool prefixes them with an apostrophe to keep them as text, while ordinary numbers such as -5 are left alone. The result downloads as json-to-csv.csv.

For the opposite direction, CSV → JSON uses the first row as property names and turns every cell into a string, even if it looks like a number. It reports an error if a heading is empty or repeated, or if a row has a different number of columns from the heading row.

Why CSV text looks garbled in Excel

A CSV file is plain text with no built-in record of its character encoding. The CSV files Poptools creates are UTF-8 and do not begin with a byte order mark, the small marker some programs use to recognize UTF-8. When you double-click such a file, Excel for Windows may read it using the system's legacy encoding instead of UTF-8, and any accented or non-Latin characters turn into gibberish.

Instead of double-clicking, use Data, then From Text/CSV in Excel and set File Origin to Unicode (UTF-8), code page 65001. Menu names vary a little between versions, and most other spreadsheet apps also let you choose the encoding when importing.

Watch for altered numbers during import as well. Spreadsheets strip leading zeros from postal codes and phone numbers, and long numbers beyond 15 digits can switch to scientific notation or lose their final digits. Setting those columns to Text in the import step preserves the original values.

Make checking the result a habit

After converting, start by comparing row counts: the number of objects in the JSON array should equal the number of data rows in the CSV, not counting the heading. Cells containing commas or line breaks are wrapped in double quotes in CSV, so seeing quotes when you open the file in a text editor is normal.

Feeding the CSV back through CSV → JSON shows exactly what changes on a round trip. The number 30 comes back as the string "30", for example. Knowing where type information is lost helps you avoid surprises when another program reads the data later.

Tools used in this guide

More guides

บันทึกเฉพาะเครื่องมือที่คุณต้องการ