1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "jsonData": [
12 {
13 "name": "Apify",
14 "url": "https://apify.com",
15 "address": {
16 "city": "Prague",
17 "country": "CZ"
18 },
19 "tags": [
20 "scraping",
21 "automation"
22 ],
23 "rating": 4.8
24 },
25 {
26 "name": "Wikipedia",
27 "url": "https://www.wikipedia.org",
28 "address": {
29 "city": "San Francisco",
30 "country": "US"
31 },
32 "tags": [
33 "encyclopedia"
34 ],
35 "rating": 4.9
36 },
37 {
38 "name": "OpenStreetMap",
39 "url": "https://www.openstreetmap.org",
40 "address": {
41 "city": "Cambridge",
42 "country": "GB"
43 },
44 "tags": [
45 "maps",
46 "open data"
47 ],
48 "rating": 4.7
49 }
50 ],
51 "outputFormat": "xlsx"
52};
53
54
55const run = await client.actor("klyve1/json-csv-excel-converter").call(input);
56
57
58console.log('Results from dataset');
59console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
60const { items } = await client.dataset(run.defaultDatasetId).listItems();
61items.forEach((item) => {
62 console.dir(item);
63});
64
65