LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO Unflatten From JSON Function

Solved!
Go to solution

koukileo_0-1690198491925.png

 

I tried to decode but couldn't, please help me!

 

{ "data": { "PGAList": [ {"staCode": "D001", "pga": 8.848}, {"staCode": "D002", "pga": 5.751}, {"staCode": "D003", "pga": 5.469}, {"staCode": "D005", "pga": 4.347}, {"staCode": "D006", "pga": 6.411} ] } }

0 Kudos
Message 1 of 5
(1,459 Views)
Solution
Accepted by topic author koukileo

Assuming you set the correct labels, you only need to change pga from string to double.

0 Kudos
Message 2 of 5
(1,447 Views)
Solution
Accepted by topic author koukileo

koukileo_0-1690200283300.png

 

I found out that I had other setup issues. But your reply saved me a lot of debugging time. now i'm done

0 Kudos
Message 3 of 5
(1,429 Views)

I see your immediate issue is already solved, but I just thought I would note that the native LabVIEW JSON is a bit "fragile" in that the cluster passed in has to match the JSON exactly or you get nothing at all.

 

For you or anyone else who comes along later, I would recommend considering using an alternate library.  I've had good luck with this one:

https://www.vipm.io/package/jdp_science_jsontext/

 

It's slower but a lot more tolerant of minor JSON changes and will give partial decodes rather than nothing if the format is close but not exact.

0 Kudos
Message 4 of 5
(1,373 Views)

Ok thank you for your help, I will try to see what you said. Have a nice day

0 Kudos
Message 5 of 5
(1,323 Views)