Free · Fast · Privacy-first

CSV to Nested JSON

Most CSV files are stubbornly flat: one row, one record, every value on the same level.

Native JSON tool

CSV to JSON

Runs in your browser
JSON output
Run the tool to see a task-specific result.

Dot-notation headers

🔒

Auto nesting

Mixed depth supported

No upload required

Cost
Free tier
Sign-up
Not required
Processing
Tool-specific
Privacy
Clearly disclosed
IframeResponsiveAttribution included

Add this CSV to JSON to your website

Drop the CSV to JSON into a blog post, product docs, intranet, or school portal with one iframe. Processing, privacy, and usage limits are the same as on the full tool page.

  • One copy-ready line of HTML
  • Responsive — adapts to any container width
  • No API credentials are placed in the snippet

Embed code

<iframe
  src="https://www.fixtools.io/json/csv-to-json?embed=1"
  width="100%"
  height="780"
  frameborder="0"
  style="border:0;border-radius:16px;max-width:900px;"
  title="CSV to JSON by FixTools"
  loading="lazy"
  allow="clipboard-write"
></iframe>

Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.

Building nested objects from flat CSV rows

The dot-notation convention is straightforward: a header like customer.name produces a top-level customer object containing a name property, while customer.address.city produces customer.address.city three levels deep. FixTools reads each header, splits it on dots, and assembles an empty path skeleton during the first pass. On the second pass, the value for each row is assigned to the leaf position. Two headers that share a prefix automatically share the parent object in the output, so address.city and address.zip both land inside the same address object rather than creating two independent ones. This makes building rich JSON structures from a spreadsheet practical even for users with no scripting background.

For sibling objects across rows, the same header structure repeats for each row. Each CSV row becomes one fully-nested JSON object in the output array. If a particular row leaves some nested cells empty, the corresponding leaf becomes null or empty string depending on your type-inference settings, but the parent object structure is still created so the consumer can rely on a consistent schema. If you have rows where the nested object should be entirely omitted rather than present-with-nulls, post-process the JSON with a tiny script or jq filter after conversion. The converter prioritises structural consistency, which is the right default for downstream code that expects predictable keys.

Arrays inside objects need a slightly different notation. FixTools supports a bracketed-index syntax in headers: tags[0] and tags[1] become a tags array with two elements per row. Mixed array-of-object syntax also works: items[0].sku, items[0].qty, items[1].sku, items[1].qty produces an items array containing two objects each with sku and qty. The bracket-index notation is verbose but explicit, and it lets a flat CSV represent fairly rich structures without requiring a separate file per array. For arrays whose length varies per row, leave the extra columns empty and the converter will trim trailing null elements to keep the output clean.

The nested conversion still respects the same privacy and type-inference rules as the flat converter. Your data does not leave the browser. Numeric leaf cells become JSON numbers when the entire column is numeric, booleans become true booleans, and missing values are represented consistently. This combination of structural depth and clean typing makes the nested converter useful for everything from seeding development databases with realistic test data to feeding API gateways that expect richly structured payloads. The spreadsheet remains the authoring surface and the JSON is just the wire format.

How to use this tool

💡

Name your CSV headers with dot notation, paste the CSV, and the converter builds nested JSON objects automatically.

How It Works

Step-by-step guide to csv to nested json:

  1. 1

    Plan your nested structure

    Decide what the final JSON should look like for one record. Sketch the object hierarchy on paper or in a notes app. Identify which leaf fields you actually need and how they group into nested objects. This planning step takes a minute and saves rework later if you discover halfway through that the structure should be different.

  2. 2

    Write dot-notation headers

    In your spreadsheet, set the first row to dot-notation headers reflecting the structure you planned. For example, name, address.street, address.city, address.zip, contact.email, contact.phone. Save and copy the spreadsheet contents or export as CSV. The header strings drive the nesting in the output.

  3. 3

    Paste into the converter

    Open the FixTools CSV to JSON converter and paste your CSV. Enable the Nested Headers option if it is not on by default. The tool detects dot notation in the header row and adjusts its parsing strategy to build nested objects rather than flat ones.

  4. 4

    Verify the preview

    Inspect the preview pane. Check that the nested structure matches your sketch from step one. If a parent object is missing, look at your headers for typos like adress.city instead of address.city which would create two separate objects.

  5. 5

    Download or copy

    Once the structure looks right, download or copy the JSON. The output is a standard JSON array of nested objects ready to import into MongoDB, post to an API, or commit to a fixtures directory in your codebase.

Real-world examples

Common situations where this approach makes a real difference:

Seeding a NoSQL database with realistic customers

A developer building a MongoDB-backed customer service tool needs sample data with name, address, contact info, and preferences. Authoring each object in JSON is tedious. The developer sets up a Google Sheet with dot-notation headers like address.city and contact.email, fills in twenty rows, exports to CSV, and converts in FixTools. The resulting JSON array imports directly into MongoDB with mongoimport, giving realistic nested documents for testing.

API gateway test fixtures

A QA engineer maintaining test fixtures for an API gateway needs to keep pace with new schema versions. Editing nested JSON by hand is error-prone. They keep the fixtures as CSVs with dot-notation headers in version control, regenerate the JSON whenever the schema changes, and run the API tests against the fresh fixtures. The CSV authoring is friendlier and the JSON output is the canonical artifact.

Configuration migration

An ops engineer migrating a legacy CSV configuration to a nested JSON config format pastes the CSV, adds dot-notation headers to group related fields, and gets the new nested format in seconds. The migration step is one paste-convert-commit cycle instead of a custom transformation script.

Product catalog with variants

A merchandising specialist exports a product catalog from Excel where each product has nested pricing tiers and variant attributes. Using dot-notation headers like pricing.retail and variants[0].color, the CSV captures the hierarchy. Conversion in FixTools gives a JSON catalog the e-commerce platform can ingest directly.

Pro tips

Get better results with these expert suggestions:

1

Sketch the JSON shape before writing headers

Spend a minute drawing the target JSON structure for one record before you set up CSV headers. This avoids the common mistake of inventing headers ad hoc and then discovering halfway through that the nesting does not match what the consumer expects. A two-minute sketch saves a re-export later.

2

Use consistent depth across rows

If most rows have a contact.email value but one row leaves it empty, the contact object will still appear in that row with email as null or empty string. This keeps the schema consistent. Avoid trying to make some rows shallow and others deep; instead, leave cells empty and accept the consistent shape.

3

Bracket notation for arrays

To produce arrays inside nested objects, use bracket index syntax in headers: tags[0], tags[1]. For arrays of objects, combine notations: items[0].sku, items[0].qty. The notation is verbose but it lets a flat CSV represent surprisingly rich structures.

4

Validate the depth with a quick JSON.parse

After downloading, run the file through the JSON Validator. Any structural issue produced by misnamed headers shows up as either an unexpected object or a missing field. Catching this in the validator step is faster than discovering it in an API rejection later.

FAQ

Frequently asked questions

Use dot-notation in your CSV header row. Headers like address.city become an address object containing a city property. Headers that share a prefix join into the same parent object. Paste the CSV with these headers into the FixTools converter, ensure the Nested Headers option is enabled, and the output array contains the nested objects you described.
Yes. Use bracket index notation in the header. Headers like tags[0] and tags[1] become a tags array with two elements. For arrays of objects, use items[0].sku and items[0].qty. Mixing dot and bracket notation lets you describe almost any nesting structure from a flat CSV row.
The parent object structure is created consistently for every row even if some leaf cells are empty. Empty cells in numeric columns become null, in string columns become empty string by default, or null if you enable Keep Nulls. The result is a schema-consistent output where every record has the same keys.
There is no hard depth limit. Headers with several dots like company.department.team.lead are supported, though deeper nesting becomes harder to author and harder to read in the CSV. Practically, three to four levels of nesting is the sweet spot for human-editable CSV inputs.
No. The headers in row one define the schema for every data row in the output. To represent different shapes for different records you need either an extra discriminator field that consumers branch on, or multiple CSV files with different schemas converted separately and concatenated.
No. Each row produces its own independent object, so if two rows have the same address values, the output contains two equivalent address sub-objects. If you need de-duplication or normalisation into separate tables, post-process the JSON with a script after conversion.
Yes. The output is a standard JSON array. To use it with mongoimport, pass the --jsonArray flag. The nested objects map directly to BSON sub-documents and arrays become BSON arrays. Indexes on nested fields work with the standard dot-notation in MongoDB queries.
Field order in the JSON follows the column order of your CSV. Reorder the columns in your spreadsheet before pasting if you want a particular property order. Most JSON consumers do not depend on key order but it can matter for diff readability in git.
The converter does not generate JSON Schema directly. To produce a schema, run the converted output through a tool like quicktype or genson after downloading. The schema can then be checked into your project alongside the data file for downstream validation.

Related guides

More use-case guides for the same tool:

Ready to get started?

Open CSV to JSON to review its free limits and processing method.

Open CSV to JSON →

Free tier · No account needed · Transparent limits

Source-backed reference

JSON standards quick reference

Concise, standards-backed facts for developers working with JSON debugging and validation. Each rule links to a primary specification so it can be independently verified before you rely on it in code, documentation, or an incident report.

JSON standard
RFC 8259 defines JSON as a text format for serializing structured data. JSON values may be objects, arrays, strings, numbers, true, false, or null.
Verify in RFC 8259
Strings and object keys
JSON strings and object member names use double quotation marks. Single-quoted strings are not valid JSON syntax.
Verify in RFC 8259 §7
Trailing commas
The JSON grammar does not allow a comma after the final member of an object or the final element of an array.
Verify in RFC 8259 §4–5
Interoperability
ECMA-404 describes the JSON syntax independently of any programming language, which is why standard parsers can exchange the same JSON text across runtimes.
Verify in ECMA-404

Common invalid → valid JSON examples

Trailing comma

{"a":1,}{"a":1}

Single-quoted key

{'a':1}{"a":1}

Unsupported literal

{"score":NaN}{"score":null}

Built for verification, not just extraction

Direct answers are paired with primary sources and concrete examples. That makes this page useful to developers and also gives search and answer systems a clear, verifiable statement to reference instead of an unsupported summary.