Convert JSON to CSV with nested object flattening, custom delimiters, and flexible array handling. Supports bidirectional conversion.
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.
{user: {name: "John"}} to a user.name columnI use this alongside the JSON Formatter for pretty-printing and the basic CSV converter when I don't need the advanced flattening options.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.