* @param ordered Flag to denote if the parse should contruct JSON objects and arrays which maintain serialization order of the attributes.
*
* @throws JSONException Thrown if an IO error (read incomplete token) occurs.
*/
public Object parseValue(boolean ordered) throws JSONException {
if (lastToken == Token.TokenEOF) throw new JSONException("Expecting property value " + tokenizer.onLineCol());
try {
if (lastToken.isNumber()) {
Object result = lastToken.getNumber();
lastToken = tokenizer.next();
return result;
}
if (lastToken.isString()) {
Object result = lastToken.getString();
lastToken = tokenizer.next();
return result;
}
if (lastToken == Token.TokenFalse) {
lastToken = tokenizer.next();
return Boolean.FALSE;
}
if (lastToken == Token.TokenTrue) {
lastToken = tokenizer.next();
return Boolean.TRUE;
}
if (lastToken == Token.TokenNull) {
lastToken = tokenizer.next();
return null;
}
if (lastToken == Token.TokenBrackL) return parseArray(ordered, null);
if (lastToken == Token.TokenBraceL) return parseObject(ordered, null);
} catch (IOException iox) {
JSONException jex = new JSONException("Error occurred during value input read.");
jex.initCause(iox);
throw jex;
}
throw new JSONException("Invalid token " + tokenizer.onLineCol());
}