Hi - hope someone can point me in the right direction. I have a mqtt item which is receiving json that looks like
{“id”:“0e2ec14b-b596-42c2-99c7-038c285b1ef2”,“input”:“turn”,“intent”:{“intentName”:“pookieman:Light-On”,“probability”:0.6641376},“slots”:[],“sessionId”:“c7a5d80c-1de2-4343-993e-65076483234d”}
I know this as my rule is printing this to the log like this
rule "study light rule"
when
Item Study_Light changed
then
val String json = String.valueOf(Study_Light.state)
val String newValue = transform("JSONPATH", "$.intent.intentName", json)
logWarn("Raw Json", json)
logWarn("Intent Field", newValue)
end
but I expect the field newValue to only return the intentName value but when I output it - it returns the whole json blob, what am I doing wrong? I tried with the json validator and it seems to work
Thanks