Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
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.
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?