A JsonCodec encodes JSON objects to strings and decodes strings to JSON objects.

Examples:

var encoded = JSON.encode([1, 2, { "a": null }]);
var decoded = JSON.decode('["foo", { "bar": 499 }]');
Inheritance

Constructors

JsonCodec({dynamic reviver(key, value), dynamic toEncodable(object) })
Creates a JsonCodec with the given reviver and encoding function. [...]
const
JsonCodec.withReviver(dynamic reviver(key, value))
Creates a JsonCodec with the given reviver. [...]

Properties

decoder JsonDecoder
read-only
encoder JsonEncoder
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
inverted Codec<T, S>
Inverts this. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

decode(String source, { dynamic reviver(key, value) }) → dynamic
Parses the string and returns the resulting Json object. [...]
encode(Object value, { dynamic toEncodable(object) }) String
Converts value to a JSON string. [...]
fuse<R>(Codec<T, R> other) Codec<S, R>
Fuses this with other. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(other) bool
The equality operator. [...]
inherited