Hi,
I have an item with iside some json.
Some value of this json are in number format, for example “23.0”
I use this code
//Getting JSON from item
var String json = UPS_1_LOG_NEW.state.toString
//Update othe Item based on JSON
UPS_1_RUNTIME.postUpdate(transform("JSONPATH","$.upses[0].timeleft", json))
UPS_1_RUNTIME are number item, i got this error in the logs:
Cannot convert '98.0 Minutes' to a state type which item 'UPS_1_RUNTIME' accepts: [DecimalType, UnDefType].
This because in the string there is also the “MInutes”
It is possible to get only the number part of the string?
om a JSON string?
Many Thanks