A valid JSON to CSV example uses a non-empty top-level array of JSON objects, not a single object. A compact supported input is:

[{"name":"Alice","age":30},{"name":"Bob","age":31}]

The JSON To CSV converter discovers the fields name and age, creates a header, and writes one CSV record for each object.

json to csv example
JSON to CSV Example: Objects, Rows, and Output

A Complete JSON to CSV Example

Read the converted file as three CSV lines:

  • Header row: name,age
  • First record: Alice,30
  • Second record: Bob,31

In the downloadable file, the records are joined with CRLF line endings. Commas separate fields, while the order of the two columns comes from the order in which the converter first encounters those fields while scanning the parsed records from first to last.

This follows the common RFC 4180 field rules. At the CSV file level, however, Alice, 30, and Bob are character data. CSV itself does not declare that 30 was a JSON number rather than a string, so applications may infer types according to their own import rules.

Convert the Example in Four Actions

  1. Paste a valid object array. Paste the two-record example above. Confirm that the top level is a non-empty array and that every row is an object. Check the visible counter and the stated input, row, column, and output limits before continuing.
  2. Run the conversion. Convert the records. The tool parses the JSON, discovers the columns, maps each object to a CSV row, and generates the complete output locally in the current browser tab.
  3. Inspect the exact preview. Review the column order, nested JSON cells, quoting, and every reported formula-risk prefix. The preview contains the same complete string that will be placed in the downloadable file.
  4. Download and import the CSV. Download converted.csv. In the receiving application, choose UTF-8 as the character encoding and comma as the field delimiter before importing the file.

Columns, Missing Values, and Nested JSON

Column discovery is deterministic but flexible. A field is added when it first appears in the parsed objects, and a later record can introduce another column. Values are aligned with the final discovered header, so a record that predates a newly discovered field receives an empty cell for it.

JSON caseResult in the CSVPractical meaning
Missing fieldEmpty cellThe record has no value for that column.
Explicit nullEmpty cellCSV cannot distinguish null from a missing field.
false, true, or zerofalse, true, or 0These JSON primitive values retain their ordinary text forms.
Nested object or arrayCompact JSON inside one cellThe structure is preserved without creating dotted columns.
Value containing a comma, quote, CR, or LFEnclosed in double quotesInternal double quotes are doubled so the field boundary remains intact.

For example, a nested array such as ["a","b"] is not expanded into two separate columns. It becomes compact JSON, and CSV escaping protects the quotes and comma inside that field. If the receiving system needs the original structure, it must parse that cell as JSON again.

The converter does not flatten nested data because dotted column names can collide with real property names and can conceal an array’s structure. Property order inside the compact nested text follows the parsed JavaScript object’s enumeration behavior.

CSV escaping is followed by other fixed rules: the converter does not trim leading or trailing spaces, add a UTF-8 BOM, infer dates, localize numbers, or select a different delimiter based on browser locale.

Import the File in a Spreadsheet

Use the receiving spreadsheet or data application’s import workflow rather than assuming that every CSV file will be interpreted identically.

  • Select the downloaded converted.csv file.
  • Choose UTF-8 for character encoding and comma for the delimiter.
  • Check that the imported header, row count, and values match the preview.
  • Inspect any formula-risk-prefixed cells before using the imported values.

The download uses the text/csv MIME type with a UTF-8 charset, but CSV contains no character-encoding declaration or universal dialect marker. Because no BOM is added, selecting UTF-8 explicitly avoids ambiguity. Nested cells also remain text unless the application or a later import rule parses them as JSON.

Formula Safety and Local Processing

Parsing, schema discovery, CSV escaping, preview generation, and Blob download creation happen in the current browser tab. The JSON input, parsed records, CSV output, and download URL are not uploaded to Lizely.

An always-on formula-injection policy also protects the export. Field names and JSON string values qualify when they begin with =, +, -, @, tab, or carriage return, or when a formula trigger follows ECMAScript whitespace, including a leading BOM or no-break space. Qualifying text receives a leading apostrophe before CSV escaping, and the result summary reports how many cells were changed.

JSON numbers are typed data rather than attacker-controlled formula strings, so a JSON number such as -42 remains -42. The apostrophe mitigation intentionally changes some textual values, and spreadsheet programs commonly interpret it as a request to treat the cell as text. This follows the risk described in OWASP’s CSV Injection guidance.

Formula protection reduces a common risk but is not a universal guarantee for every spreadsheet, import setting, locale, or downstream transformation. A later application may remove the apostrophe or reinterpret the text. Review untrusted exports before opening them in software that can execute formulas, commands, links, or external data connections. There is no switch for disabling the default protection.

Limits and Failure Behavior

BoundaryMaximumBehavior when exceeded
Input text1,000,000 JavaScript charactersAn error is returned; no shortened CSV is produced.
Array rows10,000An error is returned; no shortened CSV is produced.
Discovered columns200An error is returned; no shortened CSV is produced.
Generated CSV5,000,000 charactersAn error is returned; no shortened CSV is produced.

These limits are explicit rather than silent caps. An over-limit input remains visible in the text area and is marked by the counter instead of being cut while typing. The accepted top-level shape is deliberately narrow: a top-level object, primitive, empty array, null row, array row, or primitive row is rejected with a specific message.

Editing the JSON clears the previous CSV, error, and download URL. Converting again revokes the older download before creating a new Blob URL, while a conversion error leaves no stale success visible. Leaving the page releases the remaining download URL.

Keep the Original JSON When Structure Matters

CSV does not carry data types, nested schemas, character-encoding declarations, or a universal dialect marker. Keep the source JSON whenever type distinctions and nested structure matter, and use a schema-aware pipeline for production migrations or regulated data. For controlled data exchange, developer fixtures, small exports, and spreadsheet preparation, the object-array example provides a practical and reviewable conversion path.

For a deeper look, see JSON to Excel Bulk: One Array to One Workbook.

For a deeper look, see Convert JSON Data into HTML Table Using JavaScript.