Item Switch True or False with JSON

I’m trying to add a switch that reads json data and translates true or false to ON or OFF. The second part is when the switch is pressed it send an mqtt payload of true or false rather then ON or OFF.

Items file

Switch Bedroom_AC1 “AC Power1” (gAC) [ “Switchable” ]
{ mqtt=“>[mosquitto:ac/bedroom/deviceOn:command:*:default],
<[mosquitto:ac/bedroom/state:state:JSONPATH($.deviceOn)]” }

Sitemap file

Switch item=Bedroom_AC1

JSON Data from mqtt

{“deviceOn”:true,“desiredTemperature”:26,“actualTemperature”:26.5,“manualMode”:false,“ecoMode”:false,“locked”:false,“fanSpeed”:“auto”,“systemMode”:“cooling”,“thermostatModel”:“BAC-002-ALW”,“logMcu”:false,“schedulesDayOffset”:1,“weekend”:false,“clockTime”:“2019-08-06 12:07:23”,“validTime”:true,“timeZone”:“Asia/Dubai”,“lastNtpSync”:“2019-08-07 01:30:44”,“firmware”:“0.95”,“ip”:“192.168.1.95”,“webServerRunning”:false}

With MQTT 1.x binding you have to create a Rule and a Proxy Item. Keep the JSONPATH binding and trigger a Rule to then convert the true/false to ON/OFF that you send to another Item.

With MQTT 2.5 M1 or later you can chain transformations so you could have the JSONPATH followed by a MAP, or even use the custom ON/OFF fields.

The same goes for the outgoing.