Hello Everyone -
Hoping someone can help me. I’m trying to transform json, however the transform function is merely returning the entire json string, not the value.
I’ve run the input thru various json parsers/validators to ensure the inputs are correct and they all return the correct value. But for whatever reason, my rule isn’t executing correctly.
I’m hoping an extra set of eyeballs will help - here’s the simple example:
rule "Notify on Log Change"
when
Item OmnilinkController_LastLogMessage received update
then
val String tempUser = transform("JSONPATH", "$.parameter2", OmnilinkController_LastLogMessage.state.toString)
logInfo("Log", "tempUser After Transformation: " + tempUser)
Here’s the input json:
{"eventNumber":20409,"timeDataValid":true,"month":12,"day":28,"hour":19,"minute":6,"eventType":48,"parameter1":2,"parameter2":1}
Here’s what gets logged:
2018-12-28 19:18:15.318 [INFO ] [g.eclipse.smarthome.model.script.Log] - tempUser After Transformation: {"eventNumber":20409,"timeDataValid":true,"month":12,"day":28,"hour":19,"minute":6,"eventType":48,"parameter1":2,"parameter2":1}
For the life of me, I can’t see why it’s not returning an error and/or returning the proper value.
Finally, I should note system details:
OpenHab 2.4
latest apt-get upgrade (updated system yesterday).
Thanks for your help!