Flatten JSON
flatten_jsonFlatten nested JSON from pasted items, a JSON/NDJSON URL or an Apify dataset into one row per item, with keys like address.city ready for CSV or spreadsheets.
Instructions
Returns one flat item per input item: nested keys become columns like address.city, ready for CSV or a spreadsheet. Flattens nested JSON from pasted items, a JSON/NDJSON URL or an Apify dataset. You choose the key separator, how arrays are written and how deep to flatten. Give at least one of: items or jsonUrl or datasetId. Runs the Apify Actor ucchiii/flatten-json on YOUR Apify account (APIFY_TOKEN); you pay that Actor's pay-per-event price, see https://apify.com/ucchiii/flatten-json.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "flatten_json"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | No | A JSON array of objects to flatten, for example an API response you copied (up to 10,000 items). | |
| arrays | No | How a list is written into its one column. 'join' joins plain values with the join separator; lists that hold objects stay JSON text either way. Empty lists become empty cells. | json |
| jsonUrl | No | Public http(s) link to a JSON array, an object holding one array (like {"data": [...]}) or NDJSON (one object per line), up to 500 MB. | |
| maxRows | No | Optional. Flatten only the first N items, for example to try your settings on a big dataset. Empty = all rows. | |
| maxDepth | No | How many levels deep to flatten. Deeper objects are kept as JSON text in one column. Default 20 (everything, in practice). | |
| datasetId | No | An Apify dataset with nested items, for example the results of a scraper run. You can paste a dataset ID or URL. Use one source: a dataset, a JSON URL or pasted JSON. | |
| separator | No | Joins nested keys into one column name: . gives address.city, _ gives address_city, __ gives address__city. 1 to 5 characters. Default: a dot. | . |
| joinSeparator | No | Used when Arrays is 'join'. Default: semicolon and space. | ; |