JSON to CSV Converter
Convert JSON to CSV with nested object flattening, custom delimiters, and flexible array handling. Supports bidirectional conversion.
Why I Built This Converter
I was tired of writing one-off Python scripts every time I needed to export API data to a spreadsheet. The problem is never the simple cases - it's the nested objects and arrays that trip you up. This tool handles the complexity I kept running into: flattening nested structures with dot notation, deciding whether to join arrays or expand them into rows, and dealing with inconsistent schemas where different objects have different keys.
What Makes This Different
- Nested Object Flattening - Converts
{user: {name: "John"}}to auser.namecolumn - Array Handling Options - Join arrays with a separator or expand each element into its own row
- Bidirectional Conversion - Go from JSON to CSV and back, with unflatten support
- Custom Delimiters - Comma, semicolon, tab, or pipe - whatever your target system expects
- Type Inference - Numbers, booleans, and nulls are properly detected when converting CSV to JSON
I use this alongside the JSON Formatter for pretty-printing and the basic CSV converter when I don't need the advanced flattening options.
Real Scenarios Where This Saves Time
API Data Export
Last week I pulled user data from an API where each user had nested address objects and an array of roles. Normally I'd write a script to flatten it. Instead, I pasted the JSON here, enabled flattening, chose "join" for the roles array, and had a clean CSV for the stakeholder report in seconds.
Database Migration
When migrating from a document database to a relational one, the JSON documents often have nested structures that need to become flat rows. The expand-to-rows option is perfect for one-to-many relationships - each nested array item becomes its own row with the parent data repeated.
Config File Conversion
Sometimes you need to convert JSON configs to CSV for bulk editing in Excel, then convert back. The unflatten option when going CSV to JSON reconstructs the nested structure, so you can round-trip your data without losing hierarchy.
Understanding the Options
Flatten Nested Objects
When enabled, nested objects like {contact: {email: "[email protected]", phone: "555"}} become columns contact.email and contact.phone. Deep nesting works too - you might end up with user.address.city.name. When disabled, nested objects are serialized as JSON strings in the cell.
Array Handling: Join vs Expand
Join is best when the array is metadata you want to keep together, like tags or categories. Arrays become comma-separated (or whatever separator you choose) in a single cell.
Expand is for when each array element should be its own row. If a user has 3 orders, you get 3 rows, one per order, with the user data repeated. This is how you'd naturally model it in a relational database.
Unflatten Dot Notation (CSV to JSON)
When converting CSV back to JSON, this option reconstructs nested objects from column names. A column named user.profile.avatar becomes {user: {profile: {avatar: "..."}}}}. Without this, you get a flat object with literal dot-containing keys.
Related Articles
- CSV to JSON Converter: Complete Guide for Developers
- CSV Processing: Everything I Learned After Breaking 3 Data Imports
- JSON vs YAML vs XML: Which One Should You Actually Use?
Frequently Asked Questions
How does nested object flattening work?
Nested objects are converted to columns using dot notation. So {user: {name: "John", email: "[email protected]"}}becomes two columns: user.name and user.email. This works recursively for deeply nested structures. The dot notation is a common convention that many tools understand, and you can unflatten it back when converting CSV to JSON.
What are my options for handling arrays?
Two options: join concatenates array elements into a single cell with your chosen separator (default comma). Expand creates multiple rows, one per array element, repeating the non-array values. Choose join for things like tags, expand for things like order line items.
Can I convert the CSV back to nested JSON?
Yes - switch to CSV to JSON mode and enable "Unflatten dot notation". This reconstructs nested objects from column names like user.address.city. Combined with type inference, you get back properly structured JSON with correct data types.
Is my data secure?
Completely. Everything runs in your browser - no server involved, no data transmission, no storage. I built CodeUtil with privacy as a core principle. Your data stays on your machine.