# Public JSON to CSV Feed (`convenient_yarn/public-json-to-csv-feed`) Actor

Flatten inline JSON or public HTTPS JSON into Excel-safe CSV with stable export URLs for automation workflows.

- **URL**: https://apify.com/convenient\_yarn/public-json-to-csv-feed.md
- **Developed by:** [Travis Berman](https://apify.com/convenient_yarn) (community)
- **Categories:** Business, Developer tools, Lead generation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Public JSON to CSV Feed

Turn inline JSON rows or a public HTTPS JSON endpoint into a deterministic CSV file that opens cleanly in Excel, Google Sheets, Airtable, Make, Zapier, and n8n workflows.

### Why this Actor

Automation users repeatedly ask how to flatten nested API data, choose stable columns, avoid manual CSV exports, and expose workflow output at a reusable URL. This Actor provides that narrow conversion layer without requiring Airtable credentials, browser automation, or private-system access.

### What it does

- accepts inline object rows or a permission-respecting public HTTPS JSON endpoint;
- selects a nested row array with `rowsPath`;
- flattens nested objects to dotted columns such as `customer.name`;
- serializes arrays as JSON strings instead of inventing columns;
- optionally projects and orders explicit columns;
- emits UTF-8 CSV with a BOM, CRLF rows, correct quote/newline escaping, and spreadsheet-formula neutralization;
- writes `OUTPUT.csv`, a summary dataset row, and a named-store CSV record whose URL stays stable when `exportKey` is reused;
- caps source data at 5 MB while streaming (the body is cancelled as soon as the limit is crossed), CSV output at 10 MB, and rows at 10,000.

### Inline example

```json
{
  "rows": [
    {"id": 1, "customer": {"name": "Ada", "region": "EU"}, "tags": ["priority"], "amount": 1250.5},
    {"id": 2, "customer": {"name": "Lin", "region": "US"}, "tags": [], "amount": 800}
  ],
  "columns": ["id", "customer.name", "customer.region", "tags", "amount"],
  "maxRows": 1000,
  "exportKey": "weekly-sales"
}
```

### Public endpoint example

```json
{
  "sourceUrl": "https://api.github.com/repos/apify/apify-sdk-js/commits?per_page=5",
  "rowsPath": "",
  "columns": ["sha", "commit.author.name", "commit.author.date", "html_url"],
  "maxRows": 100,
  "exportKey": "apify-sdk-commits"
}
```

Provide exactly one of `rows` or `sourceUrl`. Reusing an `exportKey` updates the same named storage record, which is useful for scheduled feeds.

### Output

The default dataset and `OUTPUT` record contain:

```json
{
  "source": "inline",
  "rowCount": 2,
  "sourceRowCount": 2,
  "columns": ["id", "customer.name", "customer.region", "tags", "amount"],
  "columnCount": 5,
  "truncated": false,
  "csvBytes": 115,
  "exportKey": "weekly-sales.csv",
  "exportUrl": null,
  "generatedAt": "ISO timestamp"
}
```

`exportUrl` is intentionally `null` in local runs because local file URLs are not portable. In Apify cloud it is populated from the named key-value store. A capped cloud probe verified that two runs using the same `exportKey` returned the same anonymously readable CSV URL.

### Safety

The Actor rejects non-HTTPS URLs, credentials in URLs, custom ports, localhost/private/link-local IP literals, and hostnames resolving to private addresses. Redirects are disabled. It does not log in, use proxies, bypass access controls, or accept arbitrary request headers. Only use endpoints and data you are allowed to access.

### Local development

```bash
npm ci
npm test
CRAWLEE_STORAGE_DIR="$PWD/storage" CRAWLEE_PURGE_ON_START=0 npm start
```

Pre-seed `storage/key_value_stores/default/INPUT.json` with an example before running. Keep `APIFY_TOKEN` and `APIFY_IS_AT_HOME` unset for deterministic local storage.

### Status and pricing

The Actor is published and anonymously visible in the Apify Store. Capped cloud probes verified deterministic CSV output and a stable named-store export URL across repeated runs. The current listing is free apart from normal Apify platform usage. A future paid `file-generated` event remains a hypothesis until payout/KYC is complete; invalid input and source failures must never be charged.

# Actor input Schema

## `sourceUrl` (type: `string`):

Public HTTPS endpoint returning JSON. Redirects, credentials, custom ports, and private/local hosts are rejected.

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

Array of objects to export instead of sourceUrl.

## `rowsPath` (type: `string`):

Optional dot path to an array inside the JSON response, for example data.items.

## `columns` (type: `array`):

Optional ordered list of flattened columns. Nested keys use dots, for example customer.name.

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

Hard cap on exported rows.

## `exportKey` (type: `string`):

Stable name for the CSV record. Reusing it updates the same URL on later runs.

## Actor input object example

```json
{
  "maxRows": 1000,
  "exportKey": "latest"
}
```

# Actor output Schema

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

No description

## `keyValueStore` (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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("convenient_yarn/public-json-to-csv-feed").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("convenient_yarn/public-json-to-csv-feed").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call convenient_yarn/public-json-to-csv-feed --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=convenient_yarn/public-json-to-csv-feed",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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