Closed patpicos closed 4 years ago
$ node --version v10.15.0
"dependencies": { "fs": "0.0.1-security", "jsonpath": "1.0.0" } }
This is happening to me too, and it makes so very little sense.
contents = JSON.parse(contents)
fs.readFileSync returns a string. jsonpath expects an object to query
Good point - that wasn't my issue. I had a JSON object that at the REPL said it WAS instanceof Object, but the function still threw on it. No idea why.
not pursing more work on this. closing
For anyone else facing this... I did a JSON.stringify(JSON.parse(obj))
and that resolved it for me... I can't explain why.
For anyone else facing this... I did a
JSON.stringify(JSON.parse(obj))
and that resolved it for me... I can't explain why.
This loses all class types instances information (e.g. instanceof
)
Error:
Code:
will attach the input2 file.
I have confirmed that the query works against the file using: http://www.jsonquerytool.com/