JSONPath-Plus / JSONPath

A fork of JSONPath from http://goessner.net/articles/JsonPath/
Other
975 stars 175 forks source link

jsonPath is not a function. #94

Closed jkindwall closed 5 years ago

jkindwall commented 5 years ago

Did npm install jsonpath-plus.

At the top of my script, I have:

const {jsonPath} = require('jsonpath-plus');

Later in my script, I have:

let jpResult = jsonPath({ path: '[?(@.createdBy=="Bob")].name', json: result.json });

When I run this, I get:

(node:18620) UnhandledPromiseRejectionWarning: TypeError: jsonPath is not a function.

Am I missing something?

brettz9 commented 5 years ago

The case is significant. It should be:

const {JSONPath} = require('jsonpath-plus');

Feel free to comment further, but closing as that should address the question.