JSON to CSV
Available in: English, Español, Deutsch, Français, Ελληνικά, Nederlands, Italiano
More data format tools
- CSV to JSONPaste or upload CSV and instantly convert to JSON with nested object support.
- JSON Formatter & ValidatorFormat, validate, and minify JSON with syntax highlighting.
- XML FormatterFormat, validate, and beautify XML with syntax highlighting.
- YAML FormatterFormat, validate YAML, and convert between YAML and JSON.
About This Tool
JSON (JavaScript Object Notation) was introduced by Douglas Crockford in the early 2000s as a lightweight alternative to XML for data interchange. Formally specified in RFC 8259 (https://datatracker.ietf.org/
Understanding JSON and CSV Data Formats
JSON and CSV represent two fundamentally different approaches to structuring data. JSON is a hierarchical format that supports nested objects, arrays, and multiple data types including strings, numbers, booleans, and null values. Its tree-like structure makes it ideal for representing complex relationships between data entities, which is why it dominates modern web APIs and configuration files. CSV, by contrast, is a flat tabular format where data is organized into rows and columns. Each row represents a record and each column represents a field. This simplicity is its greatest strength: CSV files can be opened in any text editor, imported into any spreadsheet application, and processed by virtually every programming language and data tool. The conversion from JSON to CSV involves a fundamental transformation from hierarchical to tabular structure. This process, known as denormalization or flattening, requires decisions about how to handle nested objects, arrays, and missing values. Dot notation flattening (e.g., address.city) is the most common approach because it preserves the path information while producing valid column headers. Understanding when to use each format is key to effective data management. JSON excels at data interchange between systems, API responses, and configuration. CSV is preferred for data analysis, reporting, bulk imports into databases, and sharing data with non-technical users who work primarily with spreadsheet applications.
How to Use
- Paste JSON data into the input field or upload a .json file.
- Adjust options like output delimiter, flatten mode, and Excel compatibility.
- Click Convert to generate CSV, then copy or download the result.
Methodology
The conversion process begins by parsing the input using the browser's native JSON.parse() method, which validates the JSON syntax and produces a JavaScript object or array. The parser then performs a complete scan of all objects in the array to extract every unique key, building a comprehensive set of column headers. For nested objects, the flattening algorithm recursively traverses each level, concatenating parent and child keys with dot notation (e.g., user.address.city). This preserves the structural relationship while producing flat column names suitable for CSV. Value escaping follows the RFC 4180 standard precisely. Any field containing a comma, double quote, or newline character is enclosed in double quotes. Double quotes within values are escaped by doubling them. Arrays encountered as values are serialized to comma-separated strings. Null and undefined values produce empty fields, ensuring the output maintains consistent column alignment across all rows.
Understanding Your Results
The CSV output begins with a header row containing column names derived from all unique JSON keys across the entire dataset. Each subsequent row maps to one object from the JSON array, with values placed in the column matching their key name. When objects have different sets of keys, the converter creates a superset of all columns. Missing values in any given object appear as empty cells in the corresponding row. This ensures data integrity while accommodating heterogeneous JSON structures. Nested objects are represented with flattened key names using dot notation (e.g., address.city, user.profile.name). This makes the hierarchical relationship visible in the column headers while keeping the data in a standard flat tabular format. When importing the CSV into a spreadsheet, these dot-notated column names can help you reconstruct the original nesting structure if needed.
Practical Examples
A simple array of objects converts directly to rows and columns. For instance, [{"name": "John Doe", "email": "john@
Tips & Best Practices
For the cleanest CSV output, ensure your JSON objects have consistent keys across all items in the array. When objects have mismatched keys, empty cells are inserted for missing values, which may require cleanup in your spreadsheet. If your JSON contains deeply nested structures, consider pre-processing to limit nesting depth. Column names like user.profile.address.street.line1 can become unwieldy in spreadsheets. Flattening to two or three levels usually provides the best balance between detail and readability. When working with large datasets, paste your JSON directly rather than typing it. The converter processes data entirely in memory, so very large files (over 50 MB) may be slow on older devices. For such cases, consider splitting the data into smaller batches.
Your data is never sent. We collect anonymous usage statistics only. Privacy details