Open Chris87-ux opened 3 months ago
Okay that's an edge case. You can use JSONata to get that Attribute.
position.altitute
is a path in an object like
{
"position": {
"altitude": 1234
}
}
But your attribute is named position.altitute
like:
{
"position.altitude": 1234
}
This is not easy to implement. e.g.
{
"bla": {
"geo.position": {
"altitude": 1234
}
}
}
What is the path? bla.geo.position.altitude
? Maybe we should implement the default JavaScript syntax:
bla['geo.position'].altitude
Thanks very much, this is the actual Json which I get from the Server: Its an Array of these JSONs, in general I'm only interested on the last one (actual one).
The structure of the response is not very common:
"position.altitude": 471,
"position.direction": 323,
"position.hdop": 1.6,
"position.latitude": 48.48151,
"position.longitude": 11.236118,
"position.pdop": 1.9,
"position satellites": 8,
"position.speed": 0,
"position.valid": true,
Should be:
"position": {
"altitude": 471,
"direction": 323,
"hdop": 1.6,
"latitude": 48.48151,
"longitude": 11.236118,
"pdop": 1.9,
"satellites": 8,
"speed": 0,
"valid": true
}
Please use JSONata in Blockly to extract the information
Fully aggree with you, as it seems they convert it from a mqtt interface. How would look the argument than for my first example? https://github.com/ioBroker/ioBroker.javascript/blob/master/docs/de/blockly.md#convert-by-jsonata-expression
If I don't split the JSON and I would like to use the last information:
Result[-1].["position.latitude"]
?
I'm sure that
Script type
Blockly
The problem
I have a JSON with various attributes, some of them can be read out with the blocky function, otheronce cant. I asked the question of Facebook already and a other user confirmed, that its a issue of the getAttr(). On use of JSON.parse() with [" "] it is working.
iobroker.current.log (in debug mode!)
No response
Version of nodejs
18.17.1
Version of ioBroker js-controller
5.0.19
Version of adapter
8.3.1