{FormJSON}

JSON to CSV Converter Online — Tabular Data Export

Flatten and transform nested JSON arrays into clean, RFC 4180 compliant CSV spreadsheets.

Source JSON100% Client-Side Local
csv OutputGenerated AST

Flattening JSON Arrays to Tabular CSV Data

Comma-Separated Values (CSV) remains the standard data interchange format for financial analysis, spreadsheet processing in Microsoft Excel and Google Sheets, data warehouse ingestion (Snowflake, BigQuery, PostgreSQL COPY), and machine learning pipelines.

However, JSON is inherently hierarchical, multi-dimensional, and schema-flexible, while CSV is strictly two-dimensional and tabular. Successfully converting JSON to CSV requires robust key flattening, schema unification across sparse records, strict RFC 4180 escaping, and proper character encoding.

Hierarchical JSON to 2D Tabular Grid Transformation

01. Dot-Notation Key Flattening

Nested sub-objects are recursively unrolled. Each nesting level is joined with dot delimiters to create unique column headers representing the full leaf path:

Source JSON: {"geo": {"lat": 37.77, "lng": -122.41}}
CSV Headers: geo.lat,geo.lng
02. Sparse Schema Unification

In non-uniform JSON collections, different records contain different keys. The converter performs a full pre-scan of all records to build the superset union of all columns, inserting empty values ("") for missing fields.

Row 1: {"id": 1, "sku": "A"} | Row 2: {"id": 2, "tax": 5}
CSV Header: id,sku,tax

RFC 4180 Escaping Rules & Edge Case Handling

Input Scenario Raw JSON Value RFC 4180 Requirement Escaped CSV Output
Contains Comma "San Francisco, CA" Must be enclosed in double quotes "San Francisco, CA"
Contains Double Quotes "15\" Monitor" Enclose in quotes and double internal quotes "15\"\" Monitor"
Multiline String "Line 1\nLine 2" Enclose in quotes; retain internal LF / CRLF "Line 1 Line 2"
Primitive Array ["admin", "ops"] Delimited string enclosed in quotes "admin|ops"
Null / Undefined null Empty string representation "" (or empty cell)

Excel Compatibility, UTF-8 BOM, & Regional Delimiters

Encoding UTF-8 Byte Order Mark (BOM)

By default, opening a standard UTF-8 encoded CSV file in Microsoft Excel on Windows can cause international characters (such as umlauts, accented characters, or CJK glyphs) to display as garbled symbols (mojibake). Prepending the 3-byte sequence 0xEF, 0xBB, 0xBF explicitly signals UTF-8 encoding to Excel's parsing engine.

Locales Semicolon Delimiters in European Worksheets

In many European countries (Germany, France, Spain, Italy), numbers use a comma as the decimal separator. In these regions, Excel expects CSV files to use semicolons (;) as the column delimiter. Use the delimiter toggle in the console to switch between comma and semicolon format.

Security Note: Formula Injection (CSV Injection) Prevention

! Sanitizing Cell Prefixes

When exporting untrusted user-generated content to CSV, values starting with symbols like =, +, -, or @ may be interpreted by Excel or LibreOffice as dynamic formula macros. For production data pipelines, prefix such values with a single quote (') or tab to neutralize formula execution.

FAQ

How does JSON to CSV conversion handle deeply nested objects?
Nested JSON objects are flattened using standard dot-notation keys. For example, a property path like {'user': {'address': {'city': 'Austin'}}} is converted into a single tabular column header named 'user.address.city' containing the cell value 'Austin'.
How are internal arrays converted into CSV cells?
Arrays of scalar values (strings, numbers) are serialized into compact pipe-separated or comma-separated lists enclosed in quotes (e.g., 'tag1|tag2|tag3'). Arrays of complex nested objects are either JSON-serialized within the cell or flattened depending on structural depth.
What is the RFC 4180 standard for CSV formatting?
RFC 4180 is the official IETF specification defining standard CSV MIME format. It mandates that any cell containing delimiters (commas), line breaks (CRLF), or double quotes must be wrapped in double quotes, and any internal double quotes must be escaped by pairing them as two consecutive double quotes ("").
Why do accented characters or non-English symbols look corrupted in Microsoft Excel?
Microsoft Excel on Windows often defaults to legacy ANSI/Windows-1252 character encoding unless a UTF-8 Byte Order Mark (BOM: 0xEF, 0xBB, 0xBF) is prefixed to the file. FormJson includes UTF-8 BOM compatibility in exported CSV downloads to ensure proper character rendering in Excel across all languages.
What delimiters are supported (comma, semicolon, tab, pipe)?
In addition to standard comma-separated values (,), our converter supports semicolons (;) which are standard in European locales where commas represent decimal points, tab characters (\t for TSV formats), and pipes (|) for data warehouse ingest.
Is there a limit on the number of JSON records I can convert?
Because all conversion runs locally in your browser using high-performance streaming parsing, you can process arrays with tens of thousands of records without data transmission delays or server timeout limitations.

Explore Related Tools & Converters

100% Client-Side