jsonValue function
Parses a JSON value from reader
into a plain JSON-like structure.
A JSON-like structure is either a number, a string, a boolean, null
, or
a List<Object>
containing JSON-like structures, or a Map<String, Object>
where the values are JSON-like structures.
Implementation
Object? jsonValue(JsonReader reader) {
if (reader.checkObject()) {
return jsonObject<Object?>(jsonValue)(reader);
}
if (reader.checkArray()) {
return jsonArray<Object?>(jsonValue)(reader);
}
if (reader.tryNull()) return null;
return reader.tryNum() ??
reader.tryString() ??
reader.tryBool() ??
(throw FormatException("Reader has no value"));
}