JsonConverter class
Converts arbitrary values from and to JSON (JavaScript Object Notation) strings.
Example
var value1 = JsonConverter.fromJson('{\'key\':123}'); // Result: { 'key': 123 }
var value2 = JsonConverter.toMap({ 'key': 123 }); // Result: '{ 'key': 123 }'
See [TypeCode]
Constructors
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
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 ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Methods
-
fromJson<
T> (TypeCode type, String value) → T - Converts JSON string into a value of type specified by a TypeCode. [...]
-
toJson(
dynamic value) → String - Converts value into JSON string. [...]
-
toMap(
String value) → Map< String, dynamic> - Converts JSON string into map object or returns empty map when conversion is not possible. [...]
-
toMapWithDefault(
String value, Map< String, dynamic> defaultValue) → Map<String, dynamic> - Converts JSON string into map object or returns default value when conversion is not possible. [...]
-
toNullableMap(
String value) → Map< String, dynamic> - Converts JSON string into map object or returns null when conversion is not possible. [...]