Hi, i want extract the Temp of an HTTP THING, this is the JSON code

"metadata": [
"value": [
  "2022-10-03 12:12:24.712",

if i set the JSONPath Expression


the result is


i want currentTemp

this is a JSON into a JSON

It’s possible to create a JS, to convert it?

Can you help me

OK, you change this while I was responding. But in both cases, neither the original version nor this new pretty printed version is valid JSON.

But assuming that it will work in OH with the escaped double quotes, your JSONPATH has given you exactly what you’ve asked for, the element “value”'s first element of the outer array and the third element of the inner array. The third element is, as you can see from the pretty print:


The escaped double quotes (i.e. \") make that not valid JSON. In fact, the fact that the whole thing is in double quotes makes it not valid JSON. It’s a String of a JSON. I double JSONPATH will be able to handle that. But if we assume it could work, you need to tell it which element you want.


That almost certainly won’t work though because it’s not valid JSON so you’ll have to extract the value some other way, such as in a rule or using the REGEX transformation.



Note: is not n

I created a JS

    var n = JSON.parse(val).value[0][2];
    return JSON.parse(n).currentTemp;

Te result is 27.5

1 Like