How do you parse JSON in OH3 MQTT Thing?

Hi all. I am new to OH3. How do I get single values out of a JSON string?

{"temp1":55.06,"temp2":49.38,"temp3":53.63,"temp4":50.12,"WiFi":86}

I need temp1.

Is the Transformation like this?

`UID: mqtt:topic:c92e3237df:1a1866b5d8
label: Hot Water Temperature
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:c92e3237df
channels:

  • id: HotWater
    channelTypeUID: mqtt:number
    label: Hot Water Temperature
    description: “”
    configuration:
    stateTopic: Water/HeaterValues
    transformationPattern: JSONPATH:$.temp1
    unit: °C`

Thanks

If I use it on the Channel I see nothing

If I change it all to string then I see the full JSON in the Item. So it seems like the transform does not happen

Is the JSONPath transformation installed on your system ?

2 Likes

Aaa Probably not if it does not come as standard with the OH3 install. Let me see how to install that then

OK thanks all working now. One would think that if you can configure a setting on the Channel that it will have the code behind it to use it.

1 Like