jwiseman
(Mr. Wiseman (OH 4.3.0 Snapshot on Pi4))
1
Anybody know the syntax to pull the first object before the comma vs. it pulling the entire object which is a duplicate of the first one?
The error I’m getting:
JsonPath expressions with more than one result are only supported for Boolean, Number and String data types, please adapt your selector.
Here’s my syntax :
var String Temp7 = ‘NULL’
Temp7 = transform(“JSONPATH”, “$…NWSheadline”, results7.toString())
[
[
“WIND ADVISORY IN EFFECT FROM 4 PM FRIDAY TO 1 AM CDT SA TURDAY… …HIGH WIND WATCH IN EFFECT FROM SATURDAY MORNING THROUGH SATURDAY AF TERNOON”
],
[
“WIND ADVISORY IN EFFECT FROM 4 PM FRIDAY TO 1 AM CDT SA TURDAY… …HIGH WIND WATCH IN EFFECT FROM SATURDAY MORNING THROUGH SATURDAY AF TERNOON”
]
]
jwiseman
(Mr. Wiseman (OH 4.3.0 Snapshot on Pi4))
3
This is closer now → $…NWSheadline[0]
Looks like it removed the duplicate brackets with the comma and clumped the duplicate entries together. I believe this duplicate entry was created by mistake on their end.
[
“WIND ADVISORY IN EFFECT FROM 4 PM FRIDAY TO 1 AM CDT SA TURDAY… …HIGH WIND WATCH IN EFFECT FROM SATURDAY MORNING THROUGH SATURDAY AF TERNOON”,
“WIND ADVISORY IN EFFECT FROM 4 PM FRIDAY TO 1 AM CDT SA TURDAY… …HIGH WIND WATCH IN EFFECT FROM SATURDAY MORNING THROUGH SATURDAY AF TERNOON”
]
So, the quoted text isn’t the full JSON?
I’m pretty sure that $... is the source of the problem.
Two dots will select one or more nodes of data, so when there is more than one descendant with name NWSheadline, you will get more than one value.