Numerous Philanthropic Misanthropes

    jsonata
    TypeScript icon, indicating that this package has built-in type declarations

    1.8.6 • Public • Published

    JSONata

    JSON query and transformation language

    NPM statistics

    Build Status Coverage Status

    Reference implementation of the JSONata query and transformation language.

    Installation

    • npm install jsonata

    Quick start

    In Node.js:

    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

    In a browser:

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>JSONata test</title>
        <script src="https://cdn.jsdelivr.net/npm/jsonata/jsonata.min.js"></script>
        <script>
          function greeting() {
            var json = JSON.parse(document.getElementById('json').value);
            var result = jsonata('"Hello, " & name').evaluate(json);
            document.getElementById('greeting').innerHTML = result;
          }
        </script>
      </head>
      <body>
        <textarea id="json">{ "name": "Wilbur" }</textarea>
        <button onclick="greeting()">Click me</button>
        <p id="greeting"></p>
      </body>
    </html>

    More information

    Contributing

    See the CONTRIBUTING.md for details of how to contribute to this repo.

    Tip: Click on a version number to view a previous version's package page

    Current Tags

    • Version
      Downloads (Last 7 Days)
      • Tag
    • 1.8.6
      89,325
      • latest

    Version History

    Install

    npm i jsonata

    Homepage

    jsonata.org/

    DownloadsWeekly Downloads

    219,529

    Version

    1.8.6

    License

    MIT

    Unpacked Size

    819 kB

    Total Files

    9

    Last publish

    Collaborators

    • jsonata