JsonValue parse() throws IOException { read(); skipWhiteSpace(); JsonValue result=readValue(); skipWhiteSpace(); if (!isEndOfText()) throw error("Unexpected character"); return result; }
JsonValue parse() throws IOException { read(); skipWhiteSpace(); JsonValue result=readValue(); skipWhiteSpace(); if (!isEndOfText()) throw error("Unexpected character"); return result; }
private JsonArray readArray() throws IOException { read(); JsonArray array=new JsonArray(); skipWhiteSpace(); if (readIf(']')) { return array; } do { skipWhiteSpace(); array.add(readValue()); skipWhiteSpace(); } while (readIf(',')); if (!readIf(']')) { throw expected("',' or ']'"); } return array; }
private JsonArray readArray() throws IOException { read(); JsonArray array=new JsonArray(); skipWhiteSpace(); if (readIf(']')) { return array; } do { skipWhiteSpace(); array.add(readValue()); skipWhiteSpace(); } while (readIf(',')); if (!readIf(']')) { throw expected("',' or ']'"); } return array; }
private JsonObject readObject() throws IOException { read(); JsonObject object=new JsonObject(); skipWhiteSpace(); if (readIf('}')) { return object; } do { skipWhiteSpace(); String name=readName(); skipWhiteSpace(); if (!readIf(':')) { throw expected("':'"); } skipWhiteSpace(); object.add(name, readValue()); skipWhiteSpace(); } while (readIf(',')); if (!readIf('}')) { throw expected("',' or '}'"); } return object; }
private JsonObject readObject() throws IOException { read(); JsonObject object=new JsonObject(); skipWhiteSpace(); if (readIf('}')) { return object; } do { skipWhiteSpace(); String name=readName(); skipWhiteSpace(); if (!readIf(':')) { throw expected("':'"); } skipWhiteSpace(); object.add(name, readValue()); skipWhiteSpace(); } while (readIf(',')); if (!readIf('}')) { throw expected("',' or '}'"); } return object; }