JSON to CSV Converter

Convert raw JSON arrays or nested objects into formatted CSV tabular data for Excel, Google Sheets, or data export.

How to Use the JSON to CSV Converter

1

Input JSON Data

Paste your JSON array or object on the left, click Upload, or click Sample.

2

Choose Delimiter

Select your delimiter (Comma, Semicolon for European Excel, Tab for TSV, or Pipe).

3

Copy or Download

Conversions happen instantly in real time. Click Copy CSV or Download to export.

Tool Options

Automatic Key Flattening

Recursively flattens nested object properties into clean dot-notation table column headers (e.g. location.city).

RFC 4180 Escaping

Escapes double quotes (""), delimiters, and multiline line breaks inside cell strings to prevent spreadsheet corruption.

Excel & Sheets Ready

Generates UTF-8 encoded CSV spreadsheets compatible with Microsoft Excel, Google Sheets, Numbers, and pandas.

Your Data Privacy

Web Tool
Privacy-First Architecture
Most of our web tools process your data entirely in-browser. Where server processing is technically required, payloads are evaluated statelessly in-memory and are never stored, saved, or logged.
REST API
Stateless In-Memory Processing
When you use our API endpoints, your requests are processed strictly in-memory without persistent database storage, disk logging, or data retention.
Want to learn more about how we safeguard your information and infrastructure?
Read our full Privacy Policy for detailed security standards, data retention principles, and compliance guarantees.

What does the JSON to CSV Converter do?

The JSON to CSV Converter parses structured JavaScript Object Notation (JSON) payloads—such as API response arrays or data object dumps—and transforms them into flat, tabular Comma-Separated Values (CSV) spreadsheets. It automatically flattens nested object hierarchies into dot-notation column headers and applies RFC 4180 escaping to quotes and delimiters.

Core Concepts

Understanding JSON to CSV flattening and formatting rules:

  • Hierarchical Key Flattening: Nested properties (e.g. {"user": {"location": {"city": "Seattle"}}}) are recursively mapped into dot-notation table column headers (user.location.city).
  • Array Flattening: Primitive array items are joined with delimiters, while arrays of objects generate indexed column paths (items[0].name).
  • RFC 4180 Escaping: Escapes cell strings containing double quotes (""), commas, and multiline breaks to maintain spreadsheet layout integrity in Microsoft Excel and Google Sheets.

How to use the tool?

  1. Paste JSON Data: Paste your JSON array of objects or single JSON data structure into the left editor, click Upload, or click Sample.
  2. Choose Delimiter: Select your desired delimiter (Comma, Semicolon for European Excel, Tab for TSV, or Pipe).
  3. Copy or Download: Conversions execute instantly in real time. Click Copy CSV or Download to save your .csv spreadsheet.

Related Developer Utilities

If you work with tabular data, spreadsheets, and data transformation, explore these related tools:

REST API Integration

blueutils.com provides a free REST API endpoint (POST https://blueutils.com/api/json/to-csv) to programmatically convert JSON arrays or nested objects into RFC 4180 compliant CSV tabular data.

API Request Parameters

Name Type Description Example
rawText String Valid JSON payload string (array of objects or single object). "[{\"id\":1,\"name\":\"Alice\"}]"
delimiter String Optional delimiter character (, or ; or \t or |). Defaults to ,. ","

API Request Payload Examples

cURL

curl -X POST https://blueutils.com/api/json/to-csv \
  -H "Content-Type: application/json" \
  -d '{
    "rawText": "[{\"id\":1,\"name\":\"Alice\",\"role\":\"Admin\"},{\"id\":2,\"name\":\"Bob\",\"role\":\"Developer\"}]",
    "delimiter": ","
  }'

Python

import requests

url = "https://blueutils.com/api/json/to-csv"
payload = {
    "rawText": '[{"id":1,"name":"Alice","role":"Admin"},{"id":2,"name":"Bob","role":"Developer"}]',
    "delimiter": ","
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())

Java

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        String jsonPayload = """
            {
                "rawText": "[{\\"id\\":1,\\"name\\":\\"Alice\\"},{\\"id\\":2,\\"name\\":\\"Bob\\"}]"
            }
            """;

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://blueutils.com/api/json/to-csv"))
            .header("Content-Type", "application/json")
            .POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}

API Response Parameters

Name Type Description Example
isValid Boolean Indicates whether conversion succeeded. true
csv String Formatted CSV tabular output string. "id,name,role\n1,Alice,Admin\n2,Bob,Developer"
rowCount Number Total number of data rows generated. 2
columnCount Number Total number of unique column headers extracted. 3

API Response Payload Examples

Success Response (HTTP 200 OK)

{
  "isValid": true,
  "csv": "id,name,role\n1,Alice,Admin\n2,Bob,Developer",
  "rowCount": 2,
  "columnCount": 3
}

Validation Failure Response (HTTP 400 Bad Request)

{
  "isValid": false,
  "error": "Invalid JSON syntax: Unexpected token '}' in JSON (Line 4, Column 1)"
}

Rate Limit Exceeded Response (HTTP 429 Too Many Requests)

{
  "error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}

Why use an API to convert JSON to CSV?

Integrating the JSON to CSV API into automated ingestion pipelines, ETL tasks, and reporting systems provides key advantages:

  • Rapid Script Validation: Enables automated backend pipelines to transform REST API payloads into flat CSV reports for direct business ingestion.
  • Optimized Token Efficiency for AI Agents: LLMs struggle with escaping complex CSV quotes and headers. The API flattens JSON trees deterministically without token consumption.
  • Deterministic Accuracy Without Hallucinations: Ensures 100% compliant RFC 4180 escaping without dropping rows or misaligning columns.

Native Usage

How to convert JSON to CSV locally in terminal environments or scripts:

Windows (CMD / PowerShell)

# Convert JSON to CSV in PowerShell
Get-Content data.json | ConvertFrom-Json | Export-Csv -Path output.csv -NoTypeInformation

Linux / Unix (Bash)

# Using jq CLI to convert JSON array to CSV
jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv' data.json > output.csv

Python

Using Python standard library csv and json:

import json
import csv

with open('data.json') as f:
    data = json.load(f)

items = data if isinstance(data, list) else [data]
headers = list(items[0].keys())

with open('output.csv', 'w', newline='') as f:
    writer = csv.DictWriter(f, fieldnames=headers)
    writer.writeheader()
    writer.writerows(items)

print("Converted CSV saved.")

Java

Using Jackson (CsvMapper) in Java:

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.csv.CsvMapper;
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
import java.io.File;

public class JsonToCsvExample {
    public static void main(String[] args) throws Exception {
        JsonNode jsonTree = new ObjectMapper().readTree(new File("data.json"));
        CsvSchema.Builder csvSchemaBuilder = CsvSchema.builder();
        JsonNode firstObject = jsonTree.elements().next();
        firstObject.fieldNames().forEachRemaining(csvSchemaBuilder::addColumn);
        CsvSchema csvSchema = csvSchemaBuilder.build().withHeader();

        CsvMapper csvMapper = new CsvMapper();
        csvMapper.writerFor(JsonNode.class).with(csvSchema).writeValue(new File("output.csv"), jsonTree);
        System.out.println("CSV export completed.");
    }
}

Frequently Asked Questions (FAQ)

How are nested JSON objects converted into flat CSV columns?

Nested object properties are recursively flattened into dot-notation column headers (for example, {"user": {"location": {"city": "Seattle"}}} maps to a CSV column named user.location.city).

How does the converter handle array properties inside JSON objects?

Primitive array values (such as ["Docker", "AWS"]) are joined into a semicolon-separated string ("Docker; AWS"), while arrays of objects are mapped into indexed column paths (skills[0].name).

Why do European versions of Microsoft Excel require semicolon (;) delimiters?

In many European countries, the comma is used as the decimal separator for numbers. Using a semicolon (;) delimiter allows European Excel to open spreadsheets without confusing decimal commas with column separators.

How to convert JSON to CSV in the command line using jq or Python pandas?

In Bash using jq, run jq -r "(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv" input.json > output.csv. In Python with pandas, run python -c "import pandas as pd; pd.read_json(\"input.json\").to_csv(\"output.csv\", index=False)".

Does this tool support RFC 4180 CSV standard escaping?

Yes. All cells containing commas, double quotes (""), or line breaks are automatically wrapped in standard double quotes with quote-doubling escaping to ensure total spreadsheet compatibility.

Rate Limits

UI Limits
100 uses per 15 minutes
Max payload size: 5 MB
API Limits
5 requests per 60 minutes
Max payload size: 256 KB
Need higher API rate limits, increased payload sizes, or custom developer solutions?
Contact our engineering team at support@blueutils.com for custom rate limit increases, higher quota allocations, or tailored enterprise integrations.