private boolean moveParserToField(JsonParser parser,String path) throws IOException {
  List<String> segments=getFieldPath(path);
  for (  String segment : segments) {
    if (parser.getCurrentToken() != JsonToken.START_OBJECT) {
      return false;
    }
    boolean found=false;
    JsonToken currentToken=parser.nextToken();
    while (!found && currentToken != JsonToken.END_OBJECT) {
      if (currentToken != JsonToken.FIELD_NAME) {
        throw new IOException("Field not found at expected location");
      }
      String fieldName=parser.getText();
      if (fieldName.equals(segment)) {
        found=true;
        currentToken=parser.nextToken();
      }
 else {
        parser.nextValue();
        currentToken=skipValue(parser);
      }
    }
    if (!found) {
      return false;
    }
  }
  return true;
}

private boolean moveParserToField ( JsonParser parser , String path ) throws IOException { List < String > segments = getFieldPath ( path ) ; for ( String segment : segments ) { if ( parser . getCurrentToken ( ) != JsonToken . START_OBJECT ) { return false ; } boolean found = false ; JsonToken currentToken = parser . nextToken ( ) ; while ( ! found && currentToken != JsonToken . END_OBJECT ) { if ( currentToken != JsonToken . FIELD_NAME ) { throw new IOException ( "Field not found at expected location" ) ; } String fieldName = parser . getText ( ) ; if ( fieldName . equals ( segment ) ) { found = true ; currentToken = parser . nextToken ( ) ; } else { parser . nextValue ( ) ; currentToken = skipValue ( parser ) ; } } if ( ! found ) { return false ; } } return true ; }
don ' t materialize the entire parser content , do a targeted search for the value that matches the path .
