O'Reilly logo

JavaScript JSON Cookbook by Ray Rischpater

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using JSONPath in your Node.js application

There's an npm package available that contains an implementation of the JavaScript JSONPath implementation, so if you want to use JSONPath from Node.js, you only need to install the JSONPath module and call it directly.

Getting ready

To install the JSONPath module, run the following command to include the module in your current application:

npm install JSONPath

Alternatively, you can run the following command to include it for all projects on your system:

npm install –g JSONPath

Next, you'll have to require the module in your source code, like this:

var jsonPath = require('JSONPath');

This loads the JSONPath module into your environment, storing a reference in the jsonPath variable.

How to do it…

The JSONPath ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required