1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "items": [
10 {
11 "person": {
12 "name": "Ada",
13 "age": "42",
14 },
15 "active": "yes",
16 "tags": [
17 "math",
18 "code",
19 ],
20 },
21 {
22 "person": {
23 "name": "Grace",
24 "age": "37",
25 },
26 "active": "true",
27 "tags": ["compiler"],
28 },
29 ],
30 "mappings": [
31 {
32 "from": "person.name",
33 "to": "name",
34 },
35 {
36 "from": "person.age",
37 "to": "age",
38 },
39 {
40 "from": "active",
41 "to": "active",
42 },
43 {
44 "from": "tags",
45 "to": "tags",
46 },
47 ],
48}
49
50
51run = client.actor("eager_vitamin/apify-dataset-flatten-field-mapper").call(run_input=run_input)
52
53
54print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
55for item in client.dataset(run["defaultDatasetId"]).iterate_items():
56 print(item)
57
58