[SOLVED] JSONPATH transform returns full string

Tags: #<Tag:0x00007f6173b10298> #<Tag:0x00007f6173b10180>

I’m trying to parse the returned JSON from my thermostat to get different values into items, but for now I’m struggling with getting even one value.

I’m retrieving the ATAG One JSON output with an EXEC using a jar I found somewhere around this forum. It has a lot of key value pairs, so for debugging purposes, I removed a whole lot of them, and tried with a static string:

    val testVal=" {    \"burningHours\": 2216.91,     \"roomTemperature\": 21.5 }"
    val newValue = transform("JSONPATH", "$.roomTemperature", testVal)
    logInfo("Atag","\r\n" + newValue)

regardless of the expression I put in as second parameter in the transform function (as long as its between quotes), it will always return the full string.

When I try the same JSON path $.roomTemperature in the Jayway JsonPath Evaluator, it evaluates fine.

What am I not seeing here? I’m running openhab 2.3 with OpenHabian on a Raspberry Pi 0 W.

Is the JSONPATH transformation service installed?

PaperUI -> Addons - Transformations -> JSONPATH -> Install

1 Like

OMG. Akward. On the other hand I would have thought it would throw an error. Anyways, thanks for pointing out the obvious!

It probably did, in the openhab.log file.

You’re not the first one and you won’t be the last…
Actually you are the second one just today :wink:

Please tick the solution, thanks

Nope no error in the log, only when I don’t enter anything as path. Even an empty string as path showed no error.

Actually the behaviour of returning the whole JSON input document rather than only the parsed sub string is not only happening if the binding is not installed but also if the JSON string in the argument is not correct.