Jsonpath issue / data format?

No, it was for our benefit. We cannot see what you see.

JSONPATH transformation service is not JSONPATH, and has differences e.g. in the way it handles arrays. The return is always just a plain string, for example.

The following params works for me -

// test data, just two states
val rawjson = '[{"Jurisdiction":"Alabama","Range":"5001 to 10000","Cases Reported":5831,"Community Transmission":"Yes, defined area(s)","URL": "http://www.adph.org/"},{"Jurisdiction":"Alaska","Range":"101 to 1000","Cases Reported":335,"Community Transmission":"Yes, defined area(s)","URL": "http://dhss.alaska.gov/Pages/default.aspx"}]'
// showing how to select element of list by position
var results = transform("JSONPATH", "$.[1].Jurisdiction", rawjson)
logInfo("test", "return " + results)
// showing how to use a key with spaces, this is a tricky one
results = transform("JSONPATH", "$.[1].['Cases Reported']", rawjson)
logInfo("test", "return " + results)
// showing how to select list element by content
results =  transform("JSONPATH", "$.[?(@.Jurisdiction=='Alaska')].['Cases Reported']", rawjson)
logInfo("test", "return " + results)

log

2020-04-24 20:38:51.012 [INFO ] [.eclipse.smarthome.model.script.test] - return Alaska
2020-04-24 20:38:51.020 [INFO ] [.eclipse.smarthome.model.script.test] - return 335
2020-04-24 20:38:51.022 [INFO ] [.eclipse.smarthome.model.script.test] - return 335
2 Likes