I have created a Javascript function “new.js” which I am trying to use to extract a list of device values from the .things file and return the values to the terminal console. When I run the function node new.js “GetJsonValue()” I get “transform is not defined”. I am not sure what I am doing wrong here…
Here is my JS function:
function GetJsonValue(){
var fs = require(“fs”)
var text = fs.readFileSync(“./org.eclipse.smarthome.core.thing.Thing.json”).toString()
var result = transform(“JSONPATH”, “$.device”, text)
return result
}
console.log(eval(process.argv[2]))
I am not sure I am going about this in the right way…help please!