Preformatted text
Hey All,
I’ve been following a few threads to try and re-create the desired outcome but I haven’t quite yet got it my issue worked out.
I’m making a call to Emoncms that returns a JSON array with the code and data below.
Here is my code:
var String wattsUsedString = sendHttpGetRequest(url)
logInfo("DEBUG", "DEBUG 1: " + wattsUsedString)
var Number newValue = transform("JSONPATH", ".$[0][1]", wattsUsedString)
logInfo("DEBUG", "DEBUG 2: " + newValue)
The JSON returned value from the GET request is (DEBUG 1 printout):
[[1538784000000,0.38917973637581]]
Then the value printed out in DEBUG 2 is the same as the GET returned value (DEBUG 1).
I’m just having a heck of a time trying to understand why the JSONPATH isn’t working and pulling the last data value [0][1] of the array. The online JSONPath tool say that my “.$[0][1]” should be return the second value, so I’m guessing that the var type that I’m assigning it is wrong, but I’ve tried numerous types and none are working for me.
Any help or documentation would be much appreciated.