Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 480 Bytes

using-nodejs.md

File metadata and controls

32 lines (23 loc) · 480 Bytes
id title sidebar_label
using-nodejs
Using JSONata in a Node application
In NodeJS

Installing from NPM

npm install jsonata

Example nodejs application

var jsonata = require("jsonata");

var data = {
  example: [
    {value: 4},
    {value: 7},
    {value: 13}
  ]
};
var expression = jsonata("$sum(example.value)");
var result = expression.evaluate(data);  // returns 24

ES5 runtimes

e.g. Nashorn,

Use jsonata-es5.js or jsonata-es5.min.js