code: public JSONArray parseArray(boolean ordered) throws IOException {
          JSONArray result = new JSONArray();
  
          if (lastToken != Token.TokenBrackL) throw new IOException("Expecting '[' " + tokenizer.onLineCol());
          lastToken = tokenizer.next();
  
          while (true)
          {
              if (lastToken == Token.TokenEOF) throw new IOException("Unterminated array " + tokenizer.onLineCol());
  
              /**
               * End of the array.
               */
              if (lastToken == Token.TokenBrackR)
              {
                  lastToken = tokenizer.next();
                  break;
              }
  
              Object val = parseValue(ordered);
              result.add(val);
  
              if (lastToken == Token.TokenComma)
              {
                  lastToken = tokenizer.next();
              }
              else if (lastToken != Token.TokenBrackR)
              {
                  throw new IOException("expecting either ',' or ']' " + tokenizer.onLineCol());
              }
          }
  
          return result;
      }
docs: Method to parse out a JSON array from a JSON string
  @param ordered Flag to denote if the parse should contruct JSON objects which maintain serialization order of the attributes for all JSONOjects in the array.
  
  @throws IOException Thrown if a parse error occurs, such as a malformed JSON array.