@Test public void simpleObject() throws IOException { String obj = "{\"name\":\"value\",\"int\":1302,\"float\":1.57," + "\"negint\":-5,\"negfloat\":-1.57,\"floatexp\":-1.5e7}"; JsonLexer l = new JsonLexer(new StringReader(obj)); JsonParser p = new JsonParser(l); Map<String, Object> m = p.parseObject(); assertEquals(6, m.size()); assertEquals("value", m.get("name")); assertEquals(1302L, m.get("int")); assertEquals(1.57, m.get("float")); assertEquals(-5L, m.get("negint")); assertEquals(-1.57, m.get("negfloat")); assertEquals(-1.5e7, m.get("floatexp")); }
public Map<String, Object> parseObject() throws IOException { Type t = lexer.readNextToken(); if (t != Type.START_OBJECT) { throw new IOException("Unexpected token: " + t); } return parseObjectInternal(); }
JsonParser { public Map<String, Object> parseObject() throws IOException { Type t = lexer.readNextToken(); if (t != Type.START_OBJECT) { throw new IOException("Unexpected token: " + t); } return parseObjectInternal(); } }
JsonParser { public Map<String, Object> parseObject() throws IOException { Type t = lexer.readNextToken(); if (t != Type.START_OBJECT) { throw new IOException("Unexpected token: " + t); } return parseObjectInternal(); } JsonParser(JsonLexer lexer); }
JsonParser { public Map<String, Object> parseObject() throws IOException { Type t = lexer.readNextToken(); if (t != Type.START_OBJECT) { throw new IOException("Unexpected token: " + t); } return parseObjectInternal(); } JsonParser(JsonLexer lexer); Map<String, Object> parseObject(); List<Object> parseArray(); }
JsonParser { public Map<String, Object> parseObject() throws IOException { Type t = lexer.readNextToken(); if (t != Type.START_OBJECT) { throw new IOException("Unexpected token: " + t); } return parseObjectInternal(); } JsonParser(JsonLexer lexer); Map<String, Object> parseObject(); List<Object> parseArray();  }