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": " john doe ",
14 "email": " JOHN@EXAMPLE.COM "
15 },
16 {
17 "name": "JANE SMITH",
18 "email": "Jane.Smith@Company.IO"
19 },
20 {
21 "name": "bob wilson",
22 "email": "bob@test.com"
23 }
24 ],
25 "operations": [
26 {
27 "field": "email",
28 "action": "format_email"
29 },
30 {
31 "field": "name",
32 "action": "trim_whitespace"
33 },
34 {
35 "field": "name",
36 "action": "normalize_case",
37 "options": {
38 "case": "title"
39 }
40 }
41 ]
42};
43
44
45const run = await client.actor("parsebird/data-cleaner").call(input);
46
47
48console.log('Results from dataset');
49console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
50const { items } = await client.dataset(run.defaultDatasetId).listItems();
51items.forEach((item) => {
52 console.dir(item);
53});
54
55