07-25-2024 03:02 AM
Hi,
I want to decode a json with the following structure:
{"Result":1,"Message":"!! Stacker Status has been read successfully !!","Return_Values":[{"SID":1,"SName":"Stacker 1","Lat":22.46142,"Long":88.1408,"MinTemp":0,"MaxTemp":-62.5,"Time":"24-07-2024 13:48:53"},{"SID":2,"SName":"Stacker 2","Lat":0,"Long":0,"MinTemp":0,"MaxTemp":0,"Time":"07-07-2024 18:48:35"}]}
The json is returned by the following URL: https://cescstacker.ultratech.ind.in/api/GetStatusAll?Type=json
The attached VI is thrwing errors.
Can someone guide me please
Solved! Go to Solution.
07-25-2024 04:02 AM
Here is the JSON with better readability
{
"Result":1,
"Message":"!! Stacker Status has been read successfully !!",
"Return_Values":[
{
"SID":1,
"SName":"Stacker 1",
"Lat":22.46142,
"Long":88.1408,
"MinTemp":0,
"MaxTemp":-62.5,
"Time":"24-07-2024 13:48:53"
},
{
"SID":2,
"SName":"Stacker 2",
"Lat":0,
"Long":0,
"MinTemp":0,
"MaxTemp":0,
"Time":"07-07-2024 18:48:35"
}
]
}
Use this cluster as the LabVIEW data type:
Then use the JSONtext library to convert the JSON string to this cluster.
07-25-2024 04:20 AM
Thank you very much.
I have downloaded jdp_science_jsontext_1.8.2.122 but am unable to install it with VI package manager. How do I install a local package?
I am running LabVIEW 2015. Hopefully it is compatible.
07-25-2024 04:29 AM
Hi,
I tried to install JSONtext but VIPM complains that it is not compatible with the current version of LabVIEW.
Would the "Unflatten from json" module as used in my VI work with your cluster?
Thanks anyway
07-25-2024 04:29 AM - edited 07-25-2024 04:30 AM
You can also use the built-in "Unflatten From JSON" function:
It correctly outputs the result:
07-25-2024 04:36 AM
Worked perfectly!!
Thank you so much