jack-caissey - 2021-12-09

I am trying to convert API data into a 2D array. To do this, I am using the JSONByteArrayReader to convert the API result wstring into JSON data. What I want to do next is call the IJSONData.FindAllElementsByKey method for each key I want to retrieve in order to get arrays, and then fill the 2D array with each resulting array. However, when calling the method, the only value which gets populated into the array is the key value used to search the array.

JSONByteArrayReader_0(xExecute:=xRead, pwData := ADR(testJSON), jsonData:= pJSONData^);
IF JSONByteArrayReader_0.xDone THEN
pJSONData^.FindAllElementsByKey(wsKey := noLoadsKey, diStartIndex := 0, pResult := ADR(noloadarray), udiMaxSize := 100);
xRead := FALSE;
END_IF

will return an array with 100 elements, but the only element with a value will be noloadarray[0], and it will have the value "noLoads". Any idea on how to fix this issue? or a better alternative for converting JSON data to 2D array?