public static JsonArray fromParser ( JsonPullParser parser ) throws IOException , JsonFormatException { State state = parser . getEventType ( ) ; if ( state == State . VALUE_NULL ) { return null ; } else if ( state != State . START_ARRAY ) { throw new JsonFormatException ( "unexpected token. token=" + state , parser ) ; } JsonArray jsonArray = new JsonArray ( ) ; while ( ( state = parser . lookAhead ( ) ) != State . END_ARRAY ) { jsonArray . add ( getValue ( parser ) , state ) ; } parser . getEventType ( ) ; return jsonArray ; }
Parses the given JSON data as an array .