JSONPath Extractor: pull fields out of JSON
Pricing
from $0.91 / 1,000 output rows
JSONPath Extractor: pull fields out of JSON
Pulls fields out of nested JSON with JSONPath: $.a.b, [*], [0], slices, .., filters like [?(@.price > 10)]. Reads Apify datasets and JSON / NDJSON files, one clean row per record. Empty input = free demo.
Pricing
from $0.91 / 1,000 output rows
Rating
0.0
(0)
Developer
Actor Factory
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a day ago
Last modified
Categories
Features
Share
Pull the fields you need out of nested JSON, with JSONPath
Turns deeply nested JSON into flat rows, one row per record. For anyone who has a scraper dataset or a JSON file where the value they want sits three levels down ($.seller.address.city), inside a list ($.offers[0].price), or somewhere in the middle of a long document ($..email), and who wants to get it out without writing code or a one-off script. Write a short map of {"name": "path"}, press Start, and download the result as CSV, JSON or Excel from the dataset. It works from the Console form: nothing to install, no code is run.
Try it free: leave all inputs empty and press Start (the demo is not charged and its rows carry _demo: true).
$1.30 per 1,000 output rows, charged per row ($0.0013 a row). Extracting from 20,000 records costs $26.00. The $5 monthly free credit covers about 3,800 output rows. Reading records is free. Rows with an error, records you choose to leave out, failed runs and the demo are not charged. No scraping, no API keys.
Sample
Input records (a dataset or a JSON file), Fields:
{"orderId": "$.id","customer": "$.customer.name","itemNames": "$.items[*].name","over500": "$.items[?(@.price > 500)].name","itemsTotal": "$.items[*].price.sum()","coupon": "$.coupon.code"}
| id | customer | items | coupon |
|---|---|---|---|
| A-1001 | Aiko Tanaka | Pen 120, Notebook 480, Tote bag 1500 | SPRING |
| A-1002 | Ben Carter | Pen 120 | (none) |
| A-1003 | Chloé Martin | (empty list) | WELCOME |
Output:
| orderId | customer | itemNames | over500 | itemsTotal | coupon |
|---|---|---|---|---|---|
| A-1001 | Aiko Tanaka | ["Pen", "Notebook", "Tote bag"] | Tote bag | 2100 | SPRING |
| A-1002 | Ben Carter | Pen | null | 120 | null |
| A-1003 | Chloé Martin | null | null | null | WELCOME |
One match gives the value itself, several matches give a list, no match gives null.
What you can write
- Names and positions:
$.a.b,$['a b'],$["dc:title"],$.items[0],$.items[-1](the last one). - Everything in a list or object:
$.items[*].name,$.items.*. - Slices and unions:
$.items[1:3],$.items[::2],$.items[::-1],$.items[0,2],$['a','b']. - Search at any depth:
$..emailfinds everyemailkey wherever it is,$..*every value. - Filters:
$.items[?(@.price > 10)],[?(@.stock)](the field exists),[?(!@.isbn)],[?(@.a == 'x' && (@.b < 5 || @.c))]. Compare with== != < <= > >=; text, numbers,true,falseandnullare different types and are never mixed up (trueis not1). Inside a filter@is the item being tested and$is the record. - Filter functions:
length(@.name) > 3,count(@.tags[*]) == 2,contains(@.tags, 'sale'),contains(@.title, 'Pro'),starts_with(@.sku, 'AB-'),ends_with(...),value(@.tags[0]). - Totals at the end of a path:
.length(),.sum(),.min(),.max(),.avg(),.first(),.last(). For example$.items[*].price.sum(). A single list match is used as the list ($.items.length()counts the items;$.name.length()is the length of the text). - Shortcut: a path that starts with
.or[(like.user.name) gets the$put in front for you.
Not supported, on purpose: regular expressions and arbitrary expressions or code. Paths are checked before anything is read, so a typo fails the run at once, free, with the position of the mistake.
Fields in detail
Each entry of Fields is either a path text, or an object when you want more control:
{"city": "$.address.city","tags": {"path": "$.tags[*]", "multiple": "all"},"firstPhone": {"path": "$.phones[*]", "multiple": "first"},"country": {"path": "$.address.country", "default": "unknown"}}
- multiple:
auto(default: one match is the value, several are a list),first(only the first match),all(always a list). - default: used when the path matches nothing (the field then counts as found).
- An empty list matched with
[*]has no items, so it givesnull;$.tags(without[*]) gives the list itself, even when it is empty.
Where the records come from
- Apify datasets (resource picker, read permission only): every dataset item is a record.
- JSON or NDJSON file URLs (public links): a JSON list gives one record per item, a JSON file that is one object gives one record, an NDJSON file gives one record per line. Encoding is UTF-8.
- Records path: when the list you want is nested, for example a GeoJSON file or
{"data": {"items": [...]}}, set Records path to$.featuresor$.data.items. Every item of that list becomes a record, and your field paths are written relative to one item. - How to split: Whole document: each file (or line, or dataset item) is one record, so one path can look across the entire list.
$[?(@.rating > 8)].titlethen collects all matching titles into a single row. - Datasets and files can be mixed freely; they are read in the order given and come out as one table.
If a field has no match
- Set the field to null (default). Rows with no match are still written and charged (a row of only
nullvalues is charged too). To avoid paying for such rows, use the options below. - Leave the whole record out: a record where any field has no match is not written and not charged.
- Keep the row and list the problem in
_errors: the row is written with the fieldnulland_errorssays which path matched nothing. This row is not charged. Filter on_errorsto see what needs a look.
Keep the original record
Switch on Keep the original record to copy the top-level fields of each input record into the row; your extracted fields come after them and win when a name is the same. Without it a row holds only the fields you extracted.
Output
- Dataset: one row per record, in the input order, with your fields. Download as CSV, JSON, Excel and more from the Console.
_errors: only on rows that had a problem (see above).- STATS record (key-value store): records read per source, rows written and charged, per field how many records matched, had no match or several matches, up to 20 examples of problems, and a note for every path that matched nothing in any record (usually a typo or a wrong Records path).
Limits (cannot be raised by input)
- Up to 200,000 input records per run. If there are more records than Max input records, the run stops without writing or charging rather than giving you a partial table. Split the data first.
- 20 datasets and files per run; 100 MB per file (a JSON file: 50 MB, because it has to be read whole; use NDJSON, one JSON value per line, for bigger files); 100 fields; a path can be 1,000 characters long.
- Each path has a safety limit on the work it may do for one record and on the number of values it may return (500,000). A record that hits the limit gets
nullfor that field and an_errorsentry; the other records are not affected. - Source URLs must be public
httporhttpslinks. Addresses on internal networks (localhost, private ranges, cloud metadata) are blocked, also after redirects. CSV and Excel files are not read.
Pricing
Pay per event: $1.30 per 1,000 output rows (event record, $0.0013 per output row). Reading input records is free. Nothing is charged when the run fails, for the demo, for rows with _errors, or for records left out. Set a maximum charge per run: the Actor then writes only the first rows that fit the budget (never past it) and says so in the run summary. If the budget is lower than the price of one row, the run stops at once without charging.
On the Apify Free plan, the $5 of monthly platform credit covers about 3,800 rows a month.
Use cases
- Flatten a scraper dataset:
$.seller.address.city,$.offers[0].price,$.images[*].urlbecome plain columns - Read API responses saved as JSON: pick out the list with Records path, then the fields of each item
- Find a key wherever it hides:
$..email,$..id - Get totals and counts per record:
$.items[*].price.sum(),$.reviews.length() - Collect all the values that pass a test across a whole document: a filter with Whole document
- Prepare flat, consistent columns for the next Actor in a workflow
FAQ
Does it change my source dataset? No. It only reads it and writes a new dataset.
Why is a field null? The path matched nothing in that record. Check the spelling (names are case-sensitive) and look at the note in the run summary: it lists every path that matched nothing in any record.
Why do I get a list for one field and a single value for another? One match is returned as the value, several as a list. Set "multiple": "all" to always get a list, or "first" to always get one value.
Why did a JSON file with one big object give only one row? A single object is one record. Use Records path (for example $.items) to say where the list of records is.
Can I use regular expressions? No. Use contains(), starts_with() or ends_with() in a filter.
Can I rename or calculate? The output name is the key you choose in Fields. Totals and counts are available at the end of a path; there is no arithmetic between fields.
If this Actor saved you time, a rating on the Store helps others find it.
More tools from the same developer
- Flatten JSON to CSV — flatten nested JSON into flat rows with the separator you choose
- Dataset Type Caster — turn text columns into real numbers, booleans and dates: currencies, 1,200 vs 1.200, and Japanese era dates
- JSON to CSV Converter — turn nested JSON files or datasets into one flat CSV file
- Dataset Column Profiler — profile every column of a dataset or CSV: types, missing values, distinct counts, top values and statistics
- Filter CSV, JSON or Dataset Rows by Condition — keep only the rows of a CSV, JSON file or dataset that match simple conditions like country = US or price > 100