03-20-2026 11:02 AM
Hi all. I would like to extract the 'stdout' value from the following JSON string:
{
"jsonrpc": "2.0",
"id": 1,
"result": [
0,
{
"code": 0,
"stdout": "{\"up\":true,\"pending\":false}}\n"
}
]
}
This is a valid JSON string (checked with online validators), however I don't find a way to convert it to a LabVIEW cluster, probably because of the unnamed constant in the 'result' array.
This is what I tried:
Unflatten from JSON throws an error -375005: Type mismatch between JSON and LabVIEW.
Which is reasonable, because there is no 'unnamed' field. Honestly, I don't know what else to try.
Solved! Go to Solution.
03-20-2026 11:17 AM
03-20-2026 11:31 AM - edited 03-20-2026 11:32 AM
The data structure is not representable in LabVIEW, but you can pick it apart using the path input.
JSONText also cannot handle the array as an array, although I am almost sure it could at one point in the past.
03-20-2026 12:46 PM
Thank you. Actually I tried with paths, but... in the wrong way. Honestly I did not realize that the "array" could contain heterogenous data, having in mind LabVIEW arrays.
03-20-2026 12:56 PM - edited 03-20-2026 12:56 PM
@santo_13 ha scritto:
Oh wow, this is not a typical LV data structure, if you notice carefully, the "result" array is not of same type of elements, element 0 is numeric whereas element 1 is a dict.
You can use the https://www.vipm.io/package/jdp_science_jsontext/ to navigate to each element in that array and extract the value.
Which application conjured such an illogical data structure?
Thank for the answer. This is basically the output of a console application resident on a "smart" router, called via a json-rpc protocol. Actually I don't know what is the role of the 0 constant: I would think it's the return code of the command, but there is a seemingly more explicit "code" field.
03-20-2026 01:26 PM
@cordm wrote:
The data structure is not representable in LabVIEW, but you can pick it apart using the path input.
JSONText also cannot handle the array as an array, although I am almost sure it could at one point in the past.
If you ask for the "Result" item and parse it into JSON array elements it works fine: