1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "beforeJson": "[{\"id\": 0, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 1, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 2, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 3, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 4, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 5, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 6, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 7, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 8, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}, {\"id\": 9, \"price\": 10, \"rating\": 5, \"title\": \"Product\", \"details\": {\"stock\": 5}}]",
12 "afterJson": "[{\"id\": 0, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 1, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 2, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 3, \"price\": \"10\", \"title\": \"\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 4, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 5, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 6, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 7, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 8, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}, {\"id\": 9, \"price\": \"10\", \"title\": \"Product\", \"details\": {\"stock\": 5}, \"promo\": true}]"
13};
14
15
16const run = await client.actor("witforsurprise/json-drift-brief").call(input);
17
18
19console.log('Results from dataset');
20console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
21const { items } = await client.dataset(run.defaultDatasetId).listItems();
22items.forEach((item) => {
23 console.dir(item);
24});
25
26