parseJSON function
Parses json
to a JSON tree.
def
The default value if json
is null, empty or a blank String.
Implementation
dynamic parseJSON(Object? json, [Object? def]) {
if (json == null) return def;
if (json is String) {
if (json.isEmpty || (json.length < 100 && isBlankString(json))) return def;
return dart_convert.json.decode(json);
} else {
return json;
}
}