private int parseObject ( ) throws Exception { int elementsWritten = 0 ; while ( jsonParser . nextToken ( ) != null && jsonParser . getCurrentToken ( ) != END_OBJECT ) { if ( FIELD_NAME . equals ( jsonParser . getCurrentToken ( ) ) ) { String elementName = convertName ( jsonParser . getCurrentName ( ) ) ; //jump to element value jsonParser . nextToken ( ) ; startElement ( elementName ) ; parseElement ( elementName , false ) ; endElement ( elementName ) ; elementsWritten ++ ; } else { throw new ParserException ( "Error when parsing. Expected field name got " + jsonParser . getCurrentToken ( ) ) ; } } return elementsWritten ; }
Parses generic object .