json_safe library

Functions

decodeJsonStringToMap(String input) JsonMap
Parses input into a JsonMap.
deserializeJson<T>(String input, T fromJson(JsonMap json)) → T
Deserializes input into a model using fromJson.
deserializeJsonMap<T>(JsonMap map, {required T fromJson(JsonMap json)}) → T
Deserializes a decoded JSON map into an instance of T.
jsonEncode(JsonMap map) String
Type-safe wrapper over convert.jsonEncode that accepts a Map instead of Object?
jsonEncodePretty(JsonMap map) String

Typedefs

JsonList = List<JsonValue?>
The type definition for a JSON-serializable List.
JsonMap = Map<String, JsonValue?>
The type definition for a JSON-serializable Map.
JsonValue = Object?
Represents a JSON value.

Exceptions / Errors

JsonDecodingException
Occurs while decoding the JSON String. Indicates invalid or malformed JSON.
JsonDeserializationException
Occurs while deserializing a decoded JSON object. Indicates a structural or type mismatch between JSON and the expected model.
JsonObjectExpectedException
Occurs when a valid JSON value is not a JSON object (JsonMap).
JsonParseException