LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: JSON difficult to parse

Solved!
Go to solution

Hey Guys, My json data is something like this
{
"Currents" : {
"I1" : 2.412445,
"I2" : 2.607605,
"I3" : 2.655672
},
"Date" : "15-11-2019",
"Frequency" : 49.99259,
"Power Factors" : {
"Q1" : 0.997155,
"Q2" : 1,
"Q3" : 0.988455
},
"Powers" : {
"KA1" : 466.713,
"KA2" : 517.551,
"KA3" : 533.6165,
"KT1" : 465.3853,
"KT2" : 517.551,
"KT3" : 527.4558,
"KV1" : 35.17823,
"KV2" : 0,
"KV3" : 80.85116
},
"THDs" : {
"THDC1" : 64.92453,
"THDC2" : 59.34635,
"THDC3" : 54.73608,
"THDV1" : 1.798943,
"THDV2" : 2.569078,
"THDV3" : 1.955434
},
"Time" : "10-27-11am",
"Voltages" : {
"V1" : 231.1034,
"V12" : 400.4179,
"V2" : 231.2728,
"V23" : 400.3139,
"V3" : 230.767,
"V31" : 400.1738
}
}

And I need to retrieve the value of each individual field like I2, V23 etc and store them in a variable or an array. Can anyone help me out here ?

0 Kudos
Message 1 of 4
(2,265 Views)

Hey Guys, My json data is something like this
{
"Currents" : {
"I1" : 2.412445,
"I2" : 2.607605,
"I3" : 2.655672
},
"Date" : "15-11-2019",
"Frequency" : 49.99259,
"Power Factors" : {
"Q1" : 0.997155,
"Q2" : 1,
"Q3" : 0.988455
},
"Powers" : {
"KA1" : 466.713,
"KA2" : 517.551,
"KA3" : 533.6165,
"KT1" : 465.3853,
"KT2" : 517.551,
"KT3" : 527.4558,
"KV1" : 35.17823,
"KV2" : 0,
"KV3" : 80.85116
},
"THDs" : {
"THDC1" : 64.92453,
"THDC2" : 59.34635,
"THDC3" : 54.73608,
"THDV1" : 1.798943,
"THDV2" : 2.569078,
"THDV3" : 1.955434
},
"Time" : "10-27-11am",
"Voltages" : {
"V1" : 231.1034,
"V12" : 400.4179,
"V2" : 231.2728,
"V23" : 400.3139,
"V3" : 230.767,
"V31" : 400.1738
}
}

And I need to retrieve the value of each individual field like I2, V23 etc and store them in a variable or an array. Can anyone help me out here ?

0 Kudos
Message 2 of 4
(2,264 Views)
Solution
Accepted by topic author prateekgoyal

Search for JSON in the LabVIEW examples. Its just a matter of specifying the type. There is also an excellent addon called JSONText which you can find on VIPM (and on the LabVIEW-palette on later versions)

Certified LabVIEW Architect
Message 3 of 4
(2,225 Views)
Solution
Accepted by topic author prateekgoyal
Message 4 of 4
(2,130 Views)