JSON to CSV Converter — Flatten Nested Data avatar

JSON to CSV Converter — Flatten Nested Data

Pricing

from $1.95 / 1,000 row converteds

Go to Apify Store
JSON to CSV Converter — Flatten Nested Data

JSON to CSV Converter — Flatten Nested Data

Convert JSON arrays, objects, API responses, and nested data into CSV or TSV with flattening, field selection, and file exports.

Pricing

from $1.95 / 1,000 row converteds

Rating

0.0

(0)

Developer

junipr

junipr

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

11 hours ago

Last modified

Share

What does JSON to CSV Converter do?

JSON to CSV Converter transforms JSON data into CSV or TSV format. It accepts input from three sources: direct JSON input, a URL pointing to a JSON endpoint, or an Apify dataset ID. The actor automatically flattens nested objects using dot notation, joins arrays into comma-separated values, handles null values, and produces a properly escaped CSV file with configurable column delimiters.

The converted output is saved both as individual rows in the default dataset and as a complete file in the key-value store under the OUTPUT key. This means you can download the full CSV file directly or access individual rows through the Apify API.

Features

  • Three data sources — paste JSON directly, fetch from a URL, or pull from an Apify dataset by ID
  • CSV and TSV output — choose comma-separated or tab-separated format, or set a custom delimiter
  • Automatic nested flattening — nested objects become dot-notation columns (e.g., address.city)
  • Field selection — include only specific fields or exclude unwanted fields from the output
  • Array handling — arrays are joined with comma separators into a single cell value
  • Null value replacement — configure what empty/null values display as in the output
  • Header control — optionally exclude the header row for append workflows
  • Row limits — cap output at a maximum number of rows (up to 10,000 per run)
  • Proper CSV escaping — handles quotes, newlines, and delimiters within cell values
  • Pay-per-row pricing — only pay for rows successfully converted

Input Configuration

{
"jsonData": "[{\"id\":1,\"name\":\"Alpha\"}]",
"jsonUrl": "",
"datasetId": "",
"outputFormat": "csv",
"flattenNested": true,
"delimiter": ",",
"includeHeaders": true,
"fields": [],
"excludeFields": [],
"maxRows": 1,
"nullValue": ""
}
ParameterTypeDefaultDescription
jsonDatastringone-record JSON arrayDirect JSON string to convert. Takes priority over other sources.
jsonUrlstring""URL to fetch JSON data from
datasetIdstring""Apify dataset ID to pull items from
outputFormatstring"csv"Output format: csv or tsv
flattenNestedbooleantrueFlatten nested objects using dot notation
delimiterstring","Column separator character. Defaults to comma for CSV, tab for TSV.
includeHeadersbooleantrueInclude column headers as the first row
fieldsstring[][]Only include these fields (empty = all fields)
excludeFieldsstring[][]Exclude these fields from output
maxRowsinteger1Maximum rows to output (max 10,000)
nullValuestring""Replacement string for null/undefined/missing values

Output Format

Each row is saved as a dataset item containing the row number, the flattened data, and the formatted CSV line:

{
"rowNumber": 1,
"data": {
"body": "This is the post body text...",
"id": "1",
"title": "Converted Record",
"userId": "1"
},
"csvLine": "\"This is the post body text...\",\"1\",\"Converted Record\",\"1\""
}

The complete CSV/TSV file for successfully charged dataset rows is also saved under the KVS key OUTPUT. Empty sources and billing stops produce an uncharged diagnostic instead of an unbilled output file.

Usage Examples / Use Cases

  • Apify pipeline chaining — convert output from any Apify scraper to CSV by passing its dataset ID as input
  • API data export — fetch JSON from any REST API endpoint and convert to a spreadsheet-friendly format
  • Data transformation — flatten deeply nested JSON structures into flat tabular data for analysis
  • Report generation — produce CSV exports from JSON data sources for business reporting
  • ETL workflows — use as a transformation step between JSON data sources and database imports
  • Spreadsheet import — prepare JSON data for import into Google Sheets, Excel, or other spreadsheet tools

Ready-to-run public tasks

  • Convert one API record — fetches one public JSON record and stores headered CSV.
  • Flatten a nested record — demonstrates dot-path columns from one inline object.
  • Export selected TSV fields — selects two fields and writes tab-separated output.

Every task caps conversion at one row and demonstrates a distinct source or output behavior.

Pricing

This actor uses Pay-Per-Event (PPE) pricing: $1.95 per 1,000 rows converted ($0.00195 per row-converted event). Apify platform usage follows the live Store pricing entry.

FAQ

Can I convert output from another Apify actor?

Yes. Run any Apify actor, copy its dataset ID from the run results, and paste it into the datasetId field. The converter will fetch all items from that dataset and produce a CSV file. This is the easiest way to get CSV output from any scraper.

How does nested object flattening work?

When flattenNested is enabled (default), nested objects are flattened using dot notation. For example, {"address": {"city": "Chicago", "zip": "60601"}} becomes two columns: address.city and address.zip. Arrays are joined into a single string with comma separators. Set flattenNested to false to keep nested objects as JSON strings in cells.

What happens with inconsistent JSON records?

The converter collects all unique field names across all records. If a record is missing a field that other records have, the cell is filled with the nullValue setting (empty string by default). Columns are sorted alphabetically for consistent output.

Where is the output file stored?

The complete CSV/TSV file is saved in the run's key-value store under the key OUTPUT. You can download it from the Apify Console or through the default key-value-store record endpoint. Individual paid rows are also available in the default dataset.

Does this actor need a proxy?

No. JSON to CSV Converter is a data transformation tool that does not scrape websites. It works on any Apify plan including the free tier without any proxy configuration.