# Universal Data Converter & JSON Flattener (CSV/XLSX/XML) (`forgekit/universal-data-converter-flattener`) Actor

Bi-directional format converter & nested JSON flattener/unflattener across JSON, NDJSON, CSV, TSV, multi-sheet XLSX with cell-limit rollover, XML, SQLite, legacy encodings, and Standby MCP.

- **URL**: https://apify.com/forgekit/universal-data-converter-flattener.md
- **Developed by:** [James Edmans](https://apify.com/forgekit) (community)
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.80 / 1,000 output format files generated

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Universal Data Converter & Nested JSON Flattener (JSON, CSV, XLSX, XML, NDJSON, SQLite)

> **Apify Store Actor:** `forgekit/universal-data-converter-flattener` | **Runtime:** Node.js 22 (zero-browser deterministic converter, 256–1024 MB RAM) | **Billing:** Pay-Per-Event (PPE) + Standby MCP Server

### Overview

**Universal Data Converter & Nested JSON Flattener** converts Apify Datasets, remote files, or inline payloads bi-directionally across **JSON, NDJSON/JSONL, CSV, TSV, Multi-Sheet Excel XLSX, XML, and native SQLite (`.sqlite`)** — with full nested JSON flattening, **reverse unflattening** (`a.b.0.c` dotted CSV → structured nested JSON), legacy encoding repair (`iconv-lite`), and an inferred column schema report (`SCHEMA_REPORT`).

Engineered directly around top user complaints on competing spreadsheet and dataset converters, it prevents 5M-cell spreadsheet crashes with **automatic XLSX sheet rollover (`maxCellsPerSheet`)**, supports explicit sanitized worksheet names (`xlsxSheetName`), recovers gracefully from malformed CSV/NDJSON rows (`onMalformedRow: "skip-and-log"`), and ships with a native **Standby MCP Server** for Claude Desktop and Cursor.

### Features vs Competitors

- **7-Format Bi-Directional Engine:** Auto-sniffs and converts between JSON, NDJSON, CSV, TSV, Multi-Sheet XLSX, XML, and native SQLite (`node:sqlite` `DatabaseSync` with typed `INTEGER`/`REAL`/`TEXT` columns and safe parameterized `INSERT` transactions).
- **Deep Flatten & Reverse Unflatten:** Supports 4 nested array expansion strategies (`join`, `indexed`, `json-string`, and `unwind` row explosion) PLUS dotted-key reconstruction back into nested JSON objects and arrays.
- **Legacy Encoding Repair (`iconv-lite`):** Decodes `windows-1252`, `iso-8859-1`, `latin1`, and `utf-16le` exports cleanly without mangling European accents or symbols, and optionally prepends UTF-8 BOM (`csvUtf8Bom: true`) so Microsoft Excel displays Unicode flawlessly.
- **Voice-of-Customer Upgrades:**
  - **Automatic XLSX Cell-Limit & Row-Limit Rollover (`maxCellsPerSheet`):** Splits oversized spreadsheets cleanly into `<Sheet>_1`, `<Sheet>_2`, ... before hitting Google Sheets' 5M-cell or Excel's 1,048,576-row ceiling.
  - **Custom `xlsxSheetName` + Multi-Sheet `xlsxSheetSplitField`:** Name Excel tabs explicitly (sanitized against `[:\\/?*[\]]` and 31-char Excel limits) or split 1 dataset into 1 tab per country/category with auto-sized column widths and autofilters.
  - **Lenient Malformed-Row Recovery (`onMalformedRow: "skip-and-log"`):** Logs malformed CSV/NDJSON line details in `SUMMARY.warnings[]` instead of crashing the entire run.
  - **Native Standby MCP Server:** Tested JSON-RPC 2.0 + SSE tools (`convert_data_format`, `flatten_json_records`) for Claude Desktop, Cursor, and AI workflows.

| Capability | Universal Data Converter & Flattener | `humble-echidna/dataset-transform` | `gazidev/dataset-filter-transform` | `thecfmarketing/csv-xlsx-merger` |
|---|---|---|---|---|
| Output Formats | JSON, NDJSON, CSV, TSV, Multi-Sheet XLSX, XML, **SQLite** | JSON, CSV, XLSX | JSON, CSV, XLSX | CSV, XLSX only |
| Price per 1,000 Rows (FREE) | **$0.20** (`$0.0002/row`) | $1.00 (5x pricier!) | $0.20 + $0.002/1k read | **$3.00** + $0.10 start! |
| Flatten + Reverse Unflatten | Both (`join`, `indexed`, `json-string`, `unwind`) | Flatten only | Flatten only | None |
| Auto XLSX Cell-Limit Rollover | Built-in (`maxCellsPerSheet`) | Crashes at limit | Crashes at limit | None |
| Legacy `windows-1252` Decoding | Built-in (`iconv-lite`) | UTF-8 only | UTF-8 only | UTF-8 only |
| Standby MCP Server | Native JSON-RPC 2.0 + SSE (2 tools) | None | None | None |

### Input Configuration

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `inputFormat` | `string` | No | `"auto"` | Source format: `"auto"`, `"json"`, `"ndjson"`, `"csv"`, `"tsv"`, `"xlsx"`, or `"xml"`. |
| `outputFormats` | `string[]` | No | `["csv"]` | Target KV export formats (`"json"`, `"ndjson"`, `"csv"`, `"tsv"`, `"xlsx"`, `"xml"`, `"sqlite"`). |
| `datasetId` | `string` | No | `""` | Apify Dataset ID to ingest. |
| `fileUrl` | `string` | No | `""` | Public file URL (SSRF-protected, up to 50 MB). |
| `rawInput` | `string` | No | `""` | Inline CSV, TSV, JSON, NDJSON, or XML string payload (up to 10 MB). |
| `rows` | `object[]` | No | `[]` | Inline JSON row array (up to 100,000 rows). |
| `inputEncoding` | `string` | No | `"utf-8"` | Character encoding decoded via `iconv-lite` (`"utf-8"`, `"utf-16le"`, `"latin1"`, `"windows-1252"`, `"iso-8859-1"`). |
| `jsonRootPath` | `string` | No | `""` | Dot path to extract record array from a nested JSON/XML envelope (e.g. `"data.items"`). |
| `structureMode` | `string` | No | `"flatten"` | `"preserve"`, `"flatten"`, or `"unflatten"`. |
| `flattenSeparator` | `string` | No | `"."` | Key separator used during flatten/unflatten (`1`–`4` chars). |
| `arrayMode` | `string` | No | `"join"` | Nested array strategy: `"join"`, `"indexed"`, `"json-string"`, or `"unwind"`. |
| `arrayJoinDelimiter` | `string` | No | `", "` | Delimiter used when `arrayMode="join"`. |
| `unwindField` | `string` | No | `""` | Specific array path to explode when `arrayMode="unwind"`. |
| `csvDelimiter` | `string` | No | `","` | Column delimiter for CSV output. |
| `csvUtf8Bom` | `boolean` | No | `true` | Prepend UTF-8 BOM to CSV output for clean Microsoft Excel Unicode rendering. |
| `csvFormulaSafe` | `boolean` | No | `true` | Prefix leading `=`, `+`, `-`, `@`, `\t`, `\r` cells with `'` in CSV/XLSX outputs. |
| `xlsxSheetSplitField` | `string` | No | `""` | Optional column splitting rows into separate Excel tabs (1 tab per unique value). |
| `xlsxSheetName` | `string` | No | `"Data"` | Custom base Excel worksheet name (`1`–`31` chars, auto-sanitized). |
| `maxCellsPerSheet` | `integer` | No | `4000000` | Automatic sheet rollover threshold (`10`–`5,000,000` cells) creating `<Name>_1`, `<Name>_2`, etc. |
| `onMalformedRow` | `string` | No | `"skip-and-log"` | `"skip-and-log"` records warnings without aborting; `"fail"` throws immediately. |
| `xmlRootTag` | `string` | No | `"dataset"` | Root XML element name. |
| `xmlRowTag` | `string` | No | `"item"` | Row XML element name. |
| `sqliteTableName` | `string` | No | `"records"` | SQL-safe table name (`^[a-zA-Z_][a-zA-Z0-9_]{0,62}$`) for SQLite export. |
| `pushRowsToDataset` | `boolean` | No | `true` | Also push transformed rows to the default Apify Dataset. |
| `maxRows` | `integer` | No | `100000` | Hard upper cap on transformed rows (`1`–`500,000`). |

### Output Example

Captured directly from a local end-to-end test run flattening nested JSON records and exporting simultaneously to `csv`, `xlsx`, `xml`, and `sqlite`:

```json
{
  "id": 1,
  "company.name": "Acme Corp",
  "company.hq.city": "Berlin",
  "company.hq.country": "DE",
  "tags": "saas, b2b",
  "arr": 125000
}
```

Inferred `SCHEMA_REPORT` persisted to the Key-Value Store:

```json
{
  "inputFormat": "json",
  "rowCount": 2,
  "columnCount": 6,
  "columns": [
    { "name": "id", "inferredType": "integer", "nullCount": 0, "uniqueSampleCount": 2, "min": 1, "max": 2 },
    { "name": "company.name", "inferredType": "string", "nullCount": 0, "uniqueSampleCount": 2, "min": "Acme Corp", "max": "Globex Ltd" },
    { "name": "company.hq.city", "inferredType": "string", "nullCount": 0, "uniqueSampleCount": 2, "min": "Berlin", "max": "London" },
    { "name": "company.hq.country", "inferredType": "string", "nullCount": 0, "uniqueSampleCount": 2, "min": "DE", "max": "GB" },
    { "name": "tags", "inferredType": "string", "nullCount": 0, "uniqueSampleCount": 2, "min": "etl", "max": "saas, b2b" },
    { "name": "arr", "inferredType": "integer", "nullCount": 0, "uniqueSampleCount": 2, "min": 85000, "max": 125000 }
  ],
  "exportedFiles": [
    { "format": "csv", "kvsKey": "OUTPUT_CSV", "filename": "OUTPUT.csv", "bytes": 137 },
    { "format": "xlsx", "kvsKey": "OUTPUT_XLSX", "filename": "OUTPUT.xlsx", "bytes": 16962, "sheets": ["RevenueQ4"] },
    { "format": "xml", "kvsKey": "OUTPUT_XML", "filename": "OUTPUT.xml", "bytes": 494 },
    { "format": "sqlite", "kvsKey": "OUTPUT_SQLITE", "filename": "OUTPUT.sqlite", "bytes": 8192 }
  ],
  "warnings": [],
  "durationMs": 38
}
```

### Pay-Per-Event (PPE) Pricing

| Event Key | Event Title | Price (USD) | Billing Trigger |
|---|---|---:|---|
| `actor-start` | Actor run start | `$0.005` | Charged once per non-empty conversion run (waived on 0-row runs). |
| `file-converted` | Output format file generated | `$0.004` | Charged per generated KV export artifact (`OUTPUT_CSV`, `OUTPUT_XLSX`, `OUTPUT_SQLITE`, etc.). |
| `row-converted` | Row processed & converted | `$0.0002` | Charged per transformed output row. |
| `mcp-tool-call` | Standby MCP tool execution | `$0.003` | Charged per successful Standby MCP JSON-RPC tool invocation. |

**Cost Example:** Converting `1,000` nested JSON records into 1 Excel `.xlsx` workbook + 1 `.sqlite` database costs `$0.005 + (1,000 × $0.0002) + (2 × $0.004) = $0.213 USD`.

### Standby MCP Server & AI Agent Integration

Enable Apify Standby Mode (`APIFY_META_ORIGIN=STANDBY`) to connect `forgekit/universal-data-converter-flattener` to Claude Desktop, Cursor, or any MCP client:

- **Health Endpoint:** `GET /health`
- **MCP Endpoint:** `POST /mcp` and `GET /mcp` (Streamable HTTP + SSE)
- **Exposed MCP Tools:**
  - `convert_data_format` — Converts inline JSON, NDJSON, CSV, TSV, or XML strings between formats and returns formatted text + inferred schema.
  - `flatten_json_records` — Flattens or unflattens nested JSON arrays (`join`, `indexed`, `json-string`, `unwind`) with inferred column profiles.

```json
{
  "mcpServers": {
    "universal-data-converter-flattener": {
      "url": "https://forgekit--universal-data-converter-flattener.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

### Error Handling, Rate Limits & Limitations

- **SQL & SSRF Safety:** `sqliteTableName` is strictly validated against `^[a-zA-Z_][a-zA-Z0-9_]{0,62}$` with double-quoted identifiers and parameterized `?` value bindings (zero SQL injection surface). `fileUrl` enforces SSRF protection (`http:`/`https:` only, blocking private/loopback/metadata IPs) and a `50 MB` file cap.
- **Temporary File Hygiene:** SQLite databases are built inside isolated OS temp files, buffered into KV storage, and removed in a `finally` block so zero temporary files ever leak.
- **Unflatten Safety:** Prototype-pollution keys (`__proto__`, `constructor`, `prototype`) are ignored during nested reconstruction.

### Quick Start & Example Input

#### 1. Run in Apify Console (No Code)

1. Open **[`forgekit/universal-data-converter-flattener`](https://apify.com/forgekit/universal-data-converter-flattener)** in Apify Console and click **Try for free**.
2. Paste or adjust the ready-to-run input JSON below (safe defaults are pre-filled).
3. Click **Start** and export results as **JSON, CSV, Excel, or NDJSON** from the **Output** tab.

```json
{
  "rows": [
    {
      "id": 1,
      "company": {
        "name": "Acme Corp",
        "region": "EU"
      },
      "tags": [
        "saas",
        "b2b"
      ],
      "revenue": 125000
    }
  ],
  "maxRows": 100000
}
```

#### 2. Run via API (`apify-client` — Node.js & Python)

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('forgekit/universal-data-converter-flattener').call({"rows":[{"id":1,"company":{"name":"Acme Corp","region":"EU"},"tags":["saas","b2b"],"revenue":125000}],"maxRows":100000});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

```python
from apify_client import ApifyClient
import os

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("forgekit/universal-data-converter-flattener").call(run_input={"rows":[{"id":1,"company":{"name":"Acme Corp","region":"EU"},"tags":["saas","b2b"],"revenue":125000}],"maxRows":100000})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
print(items)
```

#### 3. Connect to n8n, Make, Zapier & Webhooks

- **n8n / Make / Zapier:** Add the official **Apify** module, choose **Run Actor**, select `forgekit/universal-data-converter-flattener`, and pass the JSON payload above.
- **Schedules & Webhooks:** Attach an Apify Schedule for recurring runs and trigger downstream webhooks automatically on `ACTOR.RUN.SUCCEEDED`.

### Use Cases — What Can You Do With This Data?

- **Automated RevOps & CRM Hygiene:** Chain **Universal Data Converter & Nested JSON Flattener (JSON, CSV, XLSX, XML, NDJSON, SQLite)** directly after any Apify scraper via Apify Integrations, Make, or n8n so clean, schema-validated records land straight in HubSpot, Salesforce, Airtable, or Google Sheets.
- **Scheduled Pipeline Automation:** Trigger runs automatically on dataset completion webhooks with deterministic, zero-hallucination TypeScript logic and predictable per-row Pay-Per-Event pricing.
- **AI & RAG Data Preparation:** Clean, deduplicate, diff, or chunk raw web extractions before embedding into Pinecone, Qdrant, Weaviate, or pgvector without burning LLM tokens on boilerplate.
- **Zero-Code Agency Workflows:** Replace brittle local Python scripts and manual Excel cleanup with reproducible, audit-logged cloud runs exported directly to JSON, CSV, NDJSON, or Excel.

### Frequently Asked Questions (FAQ)

#### How much does Universal Data Converter & Nested JSON Flattener (JSON, CSV, XLSX, XML, NDJSON, SQLite) cost to run?

You only pay for actual output via transparent Pay-Per-Event billing (starting at `$0.004` per `file-converted` (Output format file generated); see the PPE Pricing table above). Runs that produce zero billable results or fail upstream incur **`$0.00`** — including zero `actor-start` fee — and Apify's built-in **Max total charge** (`ACTOR_MAX_TOTAL_CHARGE_USD`) hard-caps spend automatically.

#### Does this Actor require proxies, logins, or CAPTCHA solving?

No. This Actor performs 100% deterministic local data processing on the inputs you provide (Apify Datasets, Key-Value Stores, inline JSON, or public file URLs). It requires zero proxies, zero headless browsers, and never depends on scraping fragile third-party websites.

#### What export formats and integrations are supported?

Every run stores structured results in an Apify Dataset downloadable as **JSON, CSV, Excel (XLSX), NDJSON, XML, or HTML Table** via Console or REST API, plus native connectors for **n8n, Make, Zapier, Google Sheets, Airtable, Slack, and webhooks**.

#### Can AI agents (Claude Desktop, Cursor, ChatGPT, LangChain) call this Actor directly via MCP?

Yes! **Universal Data Converter & Nested JSON Flattener (JSON, CSV, XLSX, XML, NDJSON, SQLite)** includes a built-in **Standby MCP Server** at `https://forgekit--universal-data-converter-flattener.apify.actor/mcp` supporting JSON-RPC 2.0 (`initialize`, `ping`, `tools/list`, `tools/call`) with Claude-compliant `^[a-zA-Z0-9_.-]{1,64}$` tool schemas.

#### How does it protect against runaway costs or bad inputs?

Every input is strictly validated upfront with Zod schemas before any work starts, user-supplied URLs pass SSRF protection blocking private/cloud-metadata IPs, and streaming `BudgetGuard` enforcement stops immediately once your result or USD budget cap is reached.

#### How fast and lightweight is it compared to browser scrapers?

It runs on lightweight **Node.js 22** (256–512 MB RAM, zero headless browser) so typical runs finish in seconds with high reliability and low platform compute cost.

### Related `forgekit` Actors

Explore companion Actors in **Data Pipeline & ETL** and core ETL utilities to chain end-to-end pipelines:

| Actor | Store Slug | Mode |
|---|---|---|
| [Dataset Merge, Fuzzy Dedupe & Cross-Join Pro](https://apify.com/forgekit/dataset-merge-dedupe-pro) | `forgekit/dataset-merge-dedupe-pro` | ✅ Standby MCP |
| [Dataset Diff & Change Detector (Added / Removed / Modified)](https://apify.com/forgekit/dataset-diff-change-detector) | `forgekit/dataset-diff-change-detector` | ✅ Standby MCP |
| [Lead List Cleaner, Schema Validator & Normalizer (B2B CRM Prep)](https://apify.com/forgekit/lead-cleaner-schema-normalizer) | `forgekit/lead-cleaner-schema-normalizer` | ✅ Standby MCP |
| [Bulk Webhook & Rate-Limited HTTP Batch Dispatcher (Retries, Auth & Capture)](https://apify.com/forgekit/bulk-webhook-http-dispatcher) | `forgekit/bulk-webhook-http-dispatcher` | Batch REST API |
| [RSS, Atom & JSON-Feed Aggregator + New-Item Monitor (MCP Ready)](https://apify.com/forgekit/rss-atom-json-feed-monitor) | `forgekit/rss-atom-json-feed-monitor` | ✅ Standby MCP |
| [PDF-to-Markdown, Clean Text & Metadata Extractor (LLM & RAG Ready + MCP)](https://apify.com/forgekit/pdf-to-markdown-text-extractor) | `forgekit/pdf-to-markdown-text-extractor` | ✅ Standby MCP |
| [Bulk Domain Availability, RDAP/WHOIS Expiry & Multi-TLD Matrix Checker (MCP)](https://apify.com/forgekit/bulk-domain-availability-rdap-matrix) | `forgekit/bulk-domain-availability-rdap-matrix` | ✅ Standby MCP |

# Actor input Schema

## `inputFormat` (type: `string`):

Source data format (auto sniffs file extension, MIME type, or magic bytes).

## `outputFormats` (type: `array`):

One or more target output formats written to Key-Value Store (json, ndjson, csv, tsv, xlsx, xml, sqlite).

## `datasetId` (type: `string`):

Apify Dataset ID to convert.

## `fileUrl` (type: `string`):

Public URL to a JSON, NDJSON, CSV, TSV, XLSX, or XML file (SSRF-protected).

## `rawInput` (type: `string`):

Inline CSV, TSV, JSON, NDJSON, or XML string payload (up to 10 MB).

## `rows` (type: `array`):

Inline JSON array of records to convert/flatten.

## `inputEncoding` (type: `string`):

Character encoding decoded via iconv-lite (fixes broken Windows-1252 / Latin-1 / UTF-16 exports).

## `jsonRootPath` (type: `string`):

Optional dot-notation path extracting the record array from a nested envelope (e.g. "data.items").

## `structureMode` (type: `string`):

Flatten nested objects to flat columns, reconstruct nested JSON from dotted keys (unflatten), or preserve.

## `flattenSeparator` (type: `string`):

Delimiter joining nested path segments during flatten/unflatten (default ".").

## `arrayMode` (type: `string`):

How nested arrays are handled during flattening (join, indexed columns, JSON string, or unwind rows).

## `arrayJoinDelimiter` (type: `string`):

Delimiter used when arrayMode is "join".

## `unwindField` (type: `string`):

Optional dot path to explode when arrayMode is "unwind" (empty unwinds the first top-level/nested array encountered).

## `csvDelimiter` (type: `string`):

Column separator used for CSV serialization (default ",").

## `csvUtf8Bom` (type: `boolean`):

Prepend UTF-8 Byte Order Mark so Microsoft Excel opens accented and Unicode characters cleanly.

## `csvFormulaSafe` (type: `boolean`):

Prefix string cells starting with =, +, -, @, tab, or CR with an apostrophe in CSV/XLSX outputs.

## `xlsxSheetSplitField` (type: `string`):

Optional column name to split rows into separate XLSX worksheets (1 tab per unique value, sanitized <= 31 chars).

## `xlsxSheetName` (type: `string`):

Base Excel worksheet name (automatically sanitized against Excel forbidden characters and 31-char limit).

## `maxCellsPerSheet` (type: `integer`):

Automatic sheet rollover threshold (Data_1, Data_2, ...) preventing Google Sheets/Excel 5M-cell crashes.

## `onMalformedRow` (type: `string`):

Skip malformed CSV/NDJSON lines and record index warnings in SUMMARY.warnings\[] instead of crashing.

## `xmlRootTag` (type: `string`):

Root XML wrapper tag name for XML output.

## `xmlRowTag` (type: `string`):

Per-record XML tag name for XML output.

## `sqliteTableName` (type: `string`):

SQL-safe table identifier used when exporting SQLite database files.

## `pushRowsToDataset` (type: `boolean`):

Also emit transformed rows to the default Apify Dataset in addition to KV Store export files.

## `maxRows` (type: `integer`):

Hard upper cap on rows processed and exported.

## Actor input object example

```json
{
  "inputFormat": "auto",
  "outputFormats": [
    "csv"
  ],
  "datasetId": "",
  "fileUrl": "",
  "rawInput": "",
  "rows": [
    {
      "id": 1,
      "company": {
        "name": "Acme Corp",
        "region": "EU"
      },
      "tags": [
        "saas",
        "b2b"
      ],
      "revenue": 125000
    }
  ],
  "inputEncoding": "utf-8",
  "jsonRootPath": "",
  "structureMode": "flatten",
  "flattenSeparator": ".",
  "arrayMode": "join",
  "arrayJoinDelimiter": ", ",
  "unwindField": "",
  "csvDelimiter": ",",
  "csvUtf8Bom": true,
  "csvFormulaSafe": true,
  "xlsxSheetSplitField": "",
  "xlsxSheetName": "Data",
  "maxCellsPerSheet": 4000000,
  "onMalformedRow": "skip-and-log",
  "xmlRootTag": "dataset",
  "xmlRowTag": "item",
  "sqliteTableName": "records",
  "pushRowsToDataset": true,
  "maxRows": 100000
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `schemaReport` (type: `string`):

No description

## `ppeLedger` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "rows": [
        {
            "id": 1,
            "company": {
                "name": "Acme Corp",
                "region": "EU"
            },
            "tags": [
                "saas",
                "b2b"
            ],
            "revenue": 125000
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("forgekit/universal-data-converter-flattener").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "rows": [{
            "id": 1,
            "company": {
                "name": "Acme Corp",
                "region": "EU",
            },
            "tags": [
                "saas",
                "b2b",
            ],
            "revenue": 125000,
        }] }

# Run the Actor and wait for it to finish
run = client.actor("forgekit/universal-data-converter-flattener").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "rows": [
    {
      "id": 1,
      "company": {
        "name": "Acme Corp",
        "region": "EU"
      },
      "tags": [
        "saas",
        "b2b"
      ],
      "revenue": 125000
    }
  ]
}' |
apify call forgekit/universal-data-converter-flattener --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,forgekit/universal-data-converter-flattener"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/rGITVWCg6VrH2Y5RS/builds/NlSFaWhBhMUdEmAtp/openapi.json
