Json decoding JSONPATH

Hello everyone,
I will need help, I get a Json character string:
{“SN”:“1356XX6X”,“MAC”:“074836BBABB4”,“Error”:null,“Information”:null,“Data”:null,“Status”:“saved”,“Datas”:[[" 235.5",“1.95”,“262”,“238.103”,“9.020”,“50.04”,“0.58”],[“235.1”,“0.70”,“151”,“382.708”,“3.522”," 50.04",“0.92”],[“235.9”,“0.22”,“11”,“165.762”,“21.803”,“50.04”,“0.22”],[“235.5”,“0.00”,“424” ,“756.398”,“4.075”,“50.04”,“0.22”]],“version”:“2.75.76”}from a binding.
Could someone give me “JSONPath Expression” to decode the 4th and 5th value of each Data group in the Things configuration
Thank you

You have a decision to make first. The openHAB JSONPATH Transformation service can only output a single result.
I think there are ways to output one string with the eight values that you asked for squashed up in one string, but that might not be what you really want?
What are you going to do with the result(s), put themin different Items i.e. eight different transforms?
Are there always eight?

Thank you for answering me,
The goal is to put each value in an item to be able to display it in the interface and / or perform processing with “Rules”.
If we can only extract one value, I think we can use the function several times for each item.

Which binding?

Mqtt binding

Sure. You need several channels, each channel with a different JSONPATH path.
What have you tried for your first one? It’s not too difficult to work out.

That’s an array. If you want the fourth element, “238.103”, you’d reference it as [3] because we count from zero.

That’s an array of arrays, [ [x], [y], [z] ] style.
So to look in the first element, that would be [0] - but that’s still an array.
To get at the “238.103” you would reference [0].[3]

That’s an ordinary JSON element that happens to have an array-of-arrays payload
To get at an element, we reference it by name - Datas
That gives us an array-of-arrays, but we already know how to deal with that - Datas.[0].[3]

1 Like

Please note the bad formatting of the return string, as it has different types of hyphens. Online JSON validators mark the string as invalid.

Thanks, it works. In fact it was relatively simple especially when it is well explained.
Thank you again rossko57

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.