
Third, you have to be sure that StudentArray has been declared, with the same number of elements as userArray, since you can't modify the length of arrays like you do with Lists.įinally, for all the previous reasons, you should start to use Lists instead of arrays, they're a lot more easier to modify and mantain.

Second, you should always check if userArray != null before checking for its content: if may well be that one index of userArray has not been declared, and that would throw an exception.

moves onto the next line ready for the next iterationįirst of all, when looping an array (or anything that implements IEnumerable), the condition must be index < array.Length and not <=, if the Length is 6, the indexes will go from 0 to 5, trying to access index 6 will throw an out of bound exception. for each user value copy into the new array Compares the stored account type to STUDENT Public string UserSorting(string userArray)įor (int i = 0 i <= userArray.Length i++) I am an A-Level computer science student and was told that I should avoid using pointers, yield statements and IENumerators which is why I have tried to avoid linked lists. However when I do this I get a NullReferenceException and I do not know why this is occurring. I am trying to search an existing jagged array (that works and is all good) for the account type "STUDENT" and put them into a new array and then add a new piece of information to each student. I am currently trying to implement a jagged array however I cannot get it to work. I’m sure it’s something to do with the ‘auto’ type, what exactly I’m not sure of which is my issue here.I know that I should be using a list of arrays or instantiating a new class for each new row. This JSON format is based on the format that comes out of the Binance API although I have changed the values to numbers to make them easy to replicate, it’s valid JSON. I’ve looked around on the forum and couldn’t find any solution to this. The error when I try to run it is : "This is not an array but you are using it as one"
XOJO ACCESS ARRAY OF ARRAYS CODE
The following line is where it fails with the error shown underneath the code snippet
XOJO ACCESS ARRAY OF ARRAYS HOW TO
It shows up as an array but I don't know how to access it When I attempt to access 'record' as an array it won't run. All other variables in the info variable are False apart from the last one Name which is Auto()

Asking for help, clarification, or responding to other answers. BaseType Nil, FullName Auto(), HasElementType True, IsArray True Thanks for contributing an answer to Stack Overflow Please be sure to answer the question.Provide details and share your research But avoid. info shows that 'record' is an array at this stage Iterate through each 'JSON' array entry in 'parsedarray'

The data appears to be processed correctly and shows up as being an array in the debugger when I look at the current variables at a breakpoint. The JSON array format is not really user friendly but it’s what I’m stuck with. This is some of my test code that demonstrates the issue I’m having. Also I will be using JSON data a lot more in future so I would like to know how to access this structure properly. I could manually process this using string manipulation quickly and easily but I would like to do it the ‘proper’ native Xojo way. Hi, I’m having an issue parsing some JSON which produces what looks like an array of arrays.
