File tree 1 file changed +15
-12
lines changed
1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,20 @@ Reference implementation of the [JSONata query and transformation language](http
19
19
In Node.js:
20
20
21
21
``` javascript
22
- var jsonata = require (" jsonata" );
23
-
24
- var data = {
25
- example: [
26
- {value: 4 },
27
- {value: 7 },
28
- {value: 13 }
29
- ]
22
+ const jsonata = require (' jsonata' );
23
+
24
+ const data = {
25
+ example: [
26
+ {value: 4 },
27
+ {value: 7 },
28
+ {value: 13 }
29
+ ]
30
30
};
31
- var expression = jsonata (" $sum(example.value)" );
32
- var result = expression .evaluate (data); // returns 24
31
+
32
+ (async () => {
33
+ const expression = jsonata (' $sum(example.value)' );
34
+ const result = await expression .evaluate (data); // returns 24
35
+ })()
33
36
```
34
37
35
38
In a browser:
@@ -42,9 +45,9 @@ In a browser:
42
45
<title >JSONata test</title >
43
46
<script src =" https://cdn.jsdelivr.net/npm/jsonata/jsonata.min.js" ></script >
44
47
<script >
45
- function greeting () {
48
+ async function greeting () {
46
49
var json = JSON .parse (document .getElementById (' json' ).value );
47
- var result = jsonata (' "Hello, " & name' ).evaluate (json);
50
+ var result = await jsonata (' "Hello, " & name' ).evaluate (json);
48
51
document .getElementById (' greeting' ).innerHTML = result;
49
52
}
50
53
</script >
You can’t perform that action at this time.
0 commit comments