01-13-2024 07:06 PM
JSON String:
{"Results00":[["2467760","4455879","5","0",""]],"Results01":[],"FldNms00":["ResultSetID","ResultValueID","CurrentInterval","OffBottomn","IDPrelog"],"FldNms01":[],"ErrMsg":["FALSE-0-"]}
That string was flattened from this data cluster of 2D and 1D arrays:
I am trying to Unflatten back to the data cluster with no luck using this LabVIEW JSON to LabVIEW Object tool.
But this solution on gives the 1st 2D array.
As seen above only the 1st 2D array was parsed.
Can anyone please help parse the rest.
Anthony Lukindo
Solved! Go to Solution.
01-13-2024 10:13 PM
The problem is that in the JSON string, "Results01" is one dimensional (Results01":[]), but in the LabVIEW cluster it is two dimensional. If you change the JSON string to ...Results01":[[]] ... it works.
01-14-2024 12:11 AM
Wow!
Thanks! The issue is with LabVIEW JSON Flatten LVObject to string JSON string.
So, the same cluster data was fed but it looks like if the Results01 2D array is empty, that function send an Empty 1D array instead!
I will get around this by sending a default 2D Blank array from the other end.
Thanks much.
01-14-2024 12:44 AM - edited 01-14-2024 12:45 AM
I just realized that LabVIEW tool for converting LVObject to JSON string needed that I set the following to TRUE
Boolean = TRUE (for LabVIEW extensions). See below:
Now the string becomes LabVIEW compatible and can be parsed back to same LV Object correctly using the UNFLATTEN VI.
Just as Paul_Cardinale pointed out in the ACCEPTED solution.
01-14-2024 01:33 AM
That TRUE Boolean did not work! I had to do this, where I replace the [] with [[]] For the Results00 and Results01 outputs.
Sheesh! I had to escape the '[' and ']' characters because they have a special meaning in LabVIEW when matching strings.
01-16-2024 09:20 AM
What LV are you using? An empty 2D string array is correct in my 2019.