JsonUtils class abstract final

Utility class for JSON parsing and validation. For type conversions (lists, strings, numbers, dates), see JsonTypeUtils.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

cleanJsonResponse(String? value) String?
Returns a cleaned version of the JSON response value by stripping outer double-quotes and unescaping any inner escaped quotes (\"), or null if the result is empty.
isJson(String? value, {bool shouldTestDecode = false, bool shouldAllowEmpty = false}) bool
Returns true if value appears to be valid JSON.
jsonDecodeSafe(String? jsonString) → dynamic
Safely decodes a JSON string, returning null on error.
jsonDecodeToMap(String? jsonString) Map<String, dynamic>?
Returns a decoded Map from the given jsonString, or null if decoding fails.
tryJsonDecode(String? value, {bool shouldCleanInput = false}) Map<String, dynamic>?
Returns a decoded Map from the JSON string value, optionally cleaning the input first when shouldCleanInput is true, or null if decoding fails.
tryJsonDecodeList(String? value) List<String>?
Returns a list of strings decoded from the JSON string value, or null if decoding fails.
tryJsonDecodeListMap(String? value) List<Map<String, dynamic>>?
Returns a list of maps decoded from the JSON string value, or null if decoding fails.