JSON to CSV
Convert a JSON array of objects to CSV. Generates headers from keys, escapes values, and handles missing/nested fields. Runs entirely in your browser.
JSON Input
Drag & drop a JSON file here, or click to browse
Accepts .json files (application/json)
Upload a .json file containing a JSON array of objects
Paste a JSON array (e.g. [{…},{…}]). Validation runs automatically.
CSV Output
Enter valid JSON and click Convert to CSV to generate output.
How JSON to CSV Conversion Works
RFC 4180 Compliant Escaping
The converter follows the RFC 4180 standard for CSV formatting, ensuring compatibility with Excel, Google Sheets, and all major CSV parsers.
// Escaping rules applied:
// 1. Fields containing commas, double quotes, or newlines are wrapped in double quotes
// 2. Internal double quotes are doubled ("" → """)
// Example transformations:
"hello" → hello
"hello, world" → "hello, world"
"he said "hi"" → "he said ""hi"""
"line1
line2" → "line1
line2"
Privacy-First Processing
All JSON parsing, CSV generation, and file downloads happen entirely in your browser. No data is ever sent to a server.
- JSON input never leaves your device
- Generated CSV is created client-side
- File downloads use browser Blob APIs
- Works completely offline after initial load
Input Requirements
The tool expects a JSON array of objects. Each object becomes a row; keys become column headers.
// Valid input (array of objects):
[
{"id": 1, "name": "Alice", "email": "alice@example.com"},
{"id": 2, "name": "Bob", "email": "bob@example.com"}
]
// Invalid inputs:
{"id": 1, "name": "Alice"} // Object, not array
[1, 2, 3] // Array of primitives
"not json at all" // String
Missing Value Handling
When objects in the array have different keys, missing values are filled with a customizable placeholder.
// Input:
[
{"id": 1, "name": "Alice", "role": "admin"},
{"id": 2, "name": "Bob"} // missing "role"
]
// With missing value = "N/A":
id,name,role
1,Alice,admin
2,Bob,N/A
// With empty missing value (default):
id,name,role
1,Alice,admin
2,Bob,
Nested Object Flattening
Dot Notation Parsing
When Flatten nested objects is enabled, one-level nested objects are flattened using dot notation (e.g., address.city). Arrays are never flattened — they are JSON-stringified as a single cell.
// Input with nested object:
[
{
"id": 1,
"name": "Alice",
"address": {
"city": "Paris",
"zip": 75001
},
"tags": ["admin", "user"]
}
]
// With flatten=true:
id,name,address.city,address.zip,tags
1,Alice,Paris,75001,"["admin","user"]"
// Note: tags array is JSON-stringified, not flattened
Flatten Off (Default)
Nested objects and arrays are JSON-stringified as single cells, preserving structure for downstream parsing.
// Same input, flatten=false (default):
id,name,address,tags
1,Alice,"{"city":"Paris","zip":75001}","["admin","user"]"
// Both address and tags are JSON-stringified
Deep Nesting Behavior
Only one level of plain objects is flattened. Deeper nesting remains JSON-stringified. Null values use the missing-value placeholder.
// Input with deeper nesting:
{
"id": 1,
"user": {
"profile": {
"name": "Alice",
"settings": { "theme": "dark" }
}
}
}
// With flatten=true:
id,user.profile.name,user.profile.settings
1,Alice,"{"theme":"dark"}"
// user.profile.settings is stringified (2+ levels deep)
// user.profile.name is flattened (1 level)
Programmatic Usage
The core engine is available as a standalone ES module for use in your own projects.
import { convertJsonToCsv } from './engine.js';
const data = [
{ id: 1, user: { name: 'Alice', age: 30 } },
{ id: 2, user: { name: 'Bob', age: 25 } }
];
const result = convertJsonToCsv(data, { flatten: true });
if (result.success) {
console.log(result.csv);
// id,user.name,user.age
// 1,Alice,30
// 2,Bob,25
}
Frequently Asked Questions
- No. All processing happens entirely in your browser. Your data never leaves your device.
- The tool expects a JSON array of objects, e.g. [{"a":1},{"a":2}]. Other JSON values will produce an error.
- Missing properties and null values are replaced with the "Missing value" placeholder (empty by default). You can customise this placeholder.
- When enabled, one-level nested objects are flattened using dot notation (e.g. address.city). Arrays are never flattened; they are JSON-stringified as a single cell. Null values still use the missing-value placeholder.
- Yes. Any cell containing a comma, double quote, or line break is wrapped in double quotes and internal double quotes are doubled, per RFC 4180.
- Yes. Use the drag-and-drop zone above the text area to upload a .json file containing a JSON array of objects.
- Yes. Use the Copy CSV or Download CSV buttons in the output pane header.
- Once the page is loaded, the tool works offline because all logic runs client-side.
Use Cases
JSON to CSV conversion helps developers move structured data between systems that speak different formats. Modern web applications frequently receive JSON responses from REST and GraphQL APIs, but analysts often need flat, tabular data for spreadsheets, business intelligence dashboards, or legacy reporting tools. Converting JSON to CSV lets stakeholders open API outputs directly in Excel or Google Sheets without writing custom parsing scripts or managing temporary databases.
Data engineers use JSON to CSV pipelines when loading semi-structured application logs into data warehouses that prefer row-based bulk imports. Mobile developers export user-event and crash logs from JSON files into CSV for regression analysis and A/B testing. Content and e-commerce teams convert product catalogs, price lists, and inventory feeds from JSON into CSV for bulk uploads to shopping platforms and marketplaces. Security teams transform JSON audit trails and access logs into CSV for fast scanning with grep-compatible workflows and SIEM imports.
Researchers converting public JSON datasets into CSV can run statistical analysis in standard spreadsheet tools. DevOps teams turn JSON configuration exports into CSV for environment comparison and change tracking across staging and production.
How-To
Paste your JSON object or array into the input field. The tool validates the structure and flags malformed syntax before conversion, so invalid input never produces a broken file. Choose whether to flatten nested objects into dot-notation columns or keep top-level keys only. Click Convert to generate the CSV output. Review the live preview, then download the CSV file or copy the transformed text to your clipboard.
- Open the JSON to CSV tool in your browser.
- Paste valid JSON into the input editor.
- Select flattening options for nested keys if needed.
- Click Convert to process the data.
- Download the CSV file or copy the output to your clipboard.
Keep JSON arrays uniform so every row maps to the same schema. Avoid deeply nested arrays unless recursive flattening is supported, or results may include unexpected blank columns. For large files, split input into smaller chunks to keep conversion fast and the output readable.