1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "samples": [
12 {
13 "id": 1,
14 "name": "Alice",
15 "email": "alice@example.com",
16 "age": 30,
17 "isActive": true,
18 "tags": [
19 "admin",
20 "user"
21 ],
22 "address": {
23 "city": "New York",
24 "zip": "10001"
25 }
26 },
27 {
28 "id": 2,
29 "name": "Bob",
30 "age": null,
31 "isActive": false,
32 "tags": [],
33 "address": {
34 "city": "London",
35 "zip": "SW1A"
36 }
37 }
38 ],
39 "schemaTitle": "My Schema"
40};
41
42
43const run = await client.actor("automation-lab/json-schema-generator").call(input);
44
45
46console.log('Results from dataset');
47console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
48const { items } = await client.dataset(run.defaultDatasetId).listItems();
49items.forEach((item) => {
50 console.dir(item);
51});
52
53