Dataset Transformer: Filter, Dedupe, JSON to CSV avatar

Dataset Transformer: Filter, Dedupe, JSON to CSV

Pricing

from $0.08 / 1,000 row inspecteds

Go to Apify Store
Dataset Transformer: Filter, Dedupe, JSON to CSV

Dataset Transformer: Filter, Dedupe, JSON to CSV

Clean datasets and JSON/CSV/JSONL with declarative filtering, deduplication, casting and CSV/JSONL exports.

Pricing

from $0.08 / 1,000 row inspecteds

Rating

0.0

(0)

Developer

Alejandro Rodriguez

Alejandro Rodriguez

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Features

Limited permissions

Share

Clean an Apify dataset, inline JSON, or a public CSV/JSONL file using declarative rules. Export the result as a fresh dataset plus CSV and JSONL downloads. No arbitrary JavaScript, AI calls, enrichment or external processing service.

Use this Actor to clean other Actors' output, deduplicate product inventories, select fields for a CRM import, cast quantities before analysis, or prepare compact records for AI agents and MCP workflows. An agent can submit a JSON configuration and read OUTPUT_SUMMARY before retrieving the dataset or export links.

Quick start

{
"inlineJson": [{"sku":"A","qty":"2"},{"sku":"A","qty":"2"},{"sku":"B","qty":"3"}],
"cast": {"qty":"integer"},
"dedupeBy": ["sku"]
}

Result: [{"sku":"A","qty":2},{"sku":"B","qty":3}]. This is the self-contained daily demo and the fallback for an empty input object. Three inspected rows and one valid run cost $0.0013 at the configured event prices.

Inputs

Supply exactly one source. Clear the inline JSON editor when switching to a dataset or URL. Omitted rules use the defaults below; the demo's cast and dedupe rules are editor prefills, not hidden rules for other sources.

FieldType / defaultMeaning
datasetIdstringExisting 17-character Apify dataset ID, read with the current run's token. No creator token is used.
inlineJsonobject arrayJSON records; an empty array is a valid source.
csvUrlHTTP(S) URLPublic UTF-8 comma-separated CSV with unique, nonempty headers.
jsonlUrlHTTP(S) URLPublic UTF-8 JSON objects, one per line; blank lines ignored.
flattenboolean / falseRecursively flatten objects; arrays and empty objects remain values.
separatorstring / .Flatten separator, 1–8 characters.
selectstring array / []Keep these fields, in this order; empty keeps all. Dot paths supported.
renameobject / {}Simultaneous exact field-name replacements, e.g. {"old":"new"}.
castobject / {}Field → integer, number, boolean, string, or date.
filtersarray / []AND of {field, op, value} rules.
dedupeBystring array / []Keep first occurrence of each transformed key tuple.
sortByarray / []Stable sorting using {field, desc:false} rules in priority order.
limitinteger / 100000Maximum output rows, applied last; zero produces empty exports.

Order: flatten → select → rename → cast → filter → deduplicate → sort → limit. Filters, dedupe and sort reference the resulting field names. Literal dotted keys take precedence over nested dot paths. Select and cast produce literal keys for dot paths; they do not rebuild nested objects. Rename changes exact keys. Collisions in flatten/rename are invalid and rejected before billing. Missing selected fields become null.

Supported operators: eq, ne, gt, gte, lt, lte, contains, notContains, regex, isEmpty, notEmpty. Empty means missing, null, empty string or empty array. Equality is type-sensitive and compares objects structurally. Ordered comparisons require matching string/number types. Text operations are case-sensitive. Regex uses JavaScript Unicode syntax without flags; syntax is checked before billing and execution runs in an isolated worker with a 2-second deadline per 1,000 values. Pathological expressions can fail a valid, already billed run; simplify them and retry.

Invalid cast values become null. Integers must be safe whole numbers; numbers must be finite. Boolean accepts true/false, 1/0 and their lowercase string equivalents. Dates accept ISO calendar dates or timezone-qualified ISO timestamps and return UTC ISO strings. Objects cast to string use JSON. Null/missing values stay null. CSV inputs have string values until cast. Dedupe keys distinguish missing from null and ignore object key order. Numeric sort is numeric when both values are numbers, otherwise text order; null/missing sort last ascending and first descending. Ties retain input order.

More examples

Clean another Actor's dataset (replace the placeholder with your dataset ID):

{
"datasetId": "YOUR_DATASET_ID__1",
"flatten": true,
"select": ["product.sku", "product.price", "category"],
"rename": {"product.sku":"sku", "product.price":"price"},
"cast": {"price":"number"},
"filters": [{"field":"price", "op":"gt", "value":0}],
"dedupeBy": ["sku"],
"sortBy": [{"field":"price", "desc":true}],
"limit": 100
}

For a file, use {"csvUrl":"https://example.com/your-export.csv","cast":{"qty":"integer"}} or {"jsonlUrl":"https://example.com/your-export.jsonl"} with an actual public file you are authorized to process. These URLs are placeholders, not demo fixtures.

Outputs

  • Default dataset: transformed rows, without extra billing per output row.
  • output.csv: RFC 4180 escaping, CRLF endings, union of output columns. Objects/arrays are JSON cells. Formula-like cells and headers starting with =, +, -, @ (including after whitespace) receive a leading apostrophe. This also changes negative numeric cells into spreadsheet-safe text. JSONL/dataset values retain their original types.
  • output.jsonl: one JSON object per line, UTF-8.
  • OUTPUT_SUMMARY and STATE: read, inspected, filtered, duplicates, limited, output, charged event counts, charge-limit status, estimated maximum event cost, and public csvUrl/jsonlUrl links after success. read counts validated source rows; inspected counts the paid prefix processed. inspected = filtered + duplicates + limited + output after successful completion. Counts before failure/abort may be partial.
  • OUTPUT_PROVENANCE: output row → original source row mapping (both 1-based). Source row numbers for CSV exclude the header; JSONL numbers count nonblank records. Dedupe preserves the first matching source row.

Empty output produces empty CSV/JSONL files. Export links are public KVS links; use appropriate retention settings and share them only with intended recipients. Store retention/access settings may restrict availability. Abort saves partial summaries; resumable/restart processing is not supported and a new run starts over.

Pricing

Configured pay-per-event prices: $0.001 per valid run plus $0.0001 per input row inspected. At 1,000 input rows: $0.001 + 1,000 × $0.0001 = $0.101. Filtered rows, duplicates and rows beyond the output limit count as inspected. Exports are included. No output-row charge.

The complete source and configuration are validated before the run fee. Invalid rules, malformed files, unsafe/inaccessible URLs and inputs exceeding limits cause no Actor event charges. Valid empty input arrays incur the run fee. Failures after validation can retain charges for work already paid. Platform usage/storage charges may still apply according to your Apify plan.

The run fee is charged once, followed by row batches of at most 1,000. Each batch is capped to the SDK's remaining event capacity before charging. Only the successfully paid prefix is transformed. A charge-limit result stops further batches and exports the already paid rows. Set the run's maximum total charge in Apify to bound event spending. estimatedMaxChargeUsd in the summary shows the configured-price upper bound; before execution you can calculate the same formula from your input row count.

Limits and source access

Maximum 100,000 input rows and 10 MiB per source (remote files also have a 10 MiB download cap; decoded JSON rows must fit 10 MiB). JSON depth is limited to 32; at most 100 entries per rule collection/map, 256 characters per field path, 512 characters per regex and 1,000 projected output columns. Structural output projection is limited to 20 MiB, and a conservative preflight CSV size estimate must fit 32 MiB. All rows are held in memory for sorting and dedupe; no streaming or multi-dataset merge is provided. Files must be UTF-8; BOM, LF and CRLF are supported. CSV has no delimiter inference, comments or automatic type inference. Uneven fields, duplicate headers and malformed quoting fail validation.

Downloads allow only public HTTP(S) destinations on ports 80/443, no embedded credentials, with DNS checks on the actual connection and every redirect, at most five redirects, a 30-second total download deadline and no compressed HTTP responses. Private, loopback, link-local, reserved and IPv4-mapped private addresses are blocked. Files requiring login are unsupported. Dataset reads use the SDK API client initialized from the current run environment/token and never create a dataset when the source is missing.

Process only data you own or have permission to use. You are responsible for source terms, copyright, privacy, retention and lawful downstream use. This utility does not grant rights to scraped data, anonymize records or guarantee spreadsheet safety in every application. No third-party affiliation is implied.

Node 24+, ESM, Apify SDK 3. Direct runtime packages: Apify SDK (Apache-2.0) and ipaddr.js (MIT); Actor code ISC. Vite is overridden to 7.3.8 to avoid the MPL-licensed CSS tooling in Vite 8. See VERIFICATION.md for test/install evidence and license-audit scope. The layout derives from actors/template-cheerio; no direct Crawlee crawler dependency is retained (the Apify SDK itself uses Crawlee core).

npm ci
npm test
npm start

An empty local input runs the demo. No publication or pricing mutation is performed by this project. Before publication the owner must configure custom events run ($0.001) and row-inspected ($0.0001), with synthetic start/dataset-item charges disabled, and verify platform billing. Cloud runs require PPE; local non-PPE runs simulate processing without charges.

More tools from the same author