gg_json library

Classes

JsonPathSegment
A compiled JSON path segment consisting of a map key and optional array indices.

Extension Types

JsonTags
Defines the data of a slot tree

Extensions

DeepCopyJson on Json
Allows to call json.deepCopy()
JsonGetSetRemove on Json
Allows to call json.set() and json.getOrNull() to write and read values
JsonObjectPaths on Json
Lists all paths in the example JSON document.
JsonVisit on Json
Visits every entry in a JSON document.

Constants

exampleJson → const Map<String, dynamic>
The example JSON document.
exampleJsonNested0 → const Map<String, dynamic>
A complex JSON document combining various structures and types.
exampleJsonNested1 → const Map<String, dynamic>
An example JSON document.
exampleJsonPrimitive → const Map<String, dynamic>
A JSON document demonstrating various primitive types.

Functions

compileJsonPath(String path) List<JsonPathSegment>
Compiles a JSON path into a list of JsonPathSegments.
deepCopy(Json json, {bool throwOnNonJsonObjects = false, bool ignoreNonJsonObjects = false, bool where(String key, dynamic value)?}) Json
Deep copies a JSON document.
deepCopyList(List list, {bool throwOnNonJsonObjects = true, bool ignoreNonJsonObjects = false, bool where(String key, dynamic value)?}) List
Deep copies a JSON List.
deepEqualsList(List la, List lb) bool
Returns true if JSON Lists are deeply equal
deeplEquals(Json a, Json b) bool
Returns true if JSON documents a and b are deeply equal.
isComplexJsonValue(dynamic a) bool
Returns true if value is a complex JSON value
isJsonValue(dynamic a) bool
Returns true if a is a valid JSON value.
isSimpleJsonValue(dynamic a) bool
Returns true if value is a simple JSON value
isValidJsonKey(String input) bool
Returns true if the given input string is a valid Dart identifier.
parseArrayIndex(String segment) → (String, Iterable<int>)
Parses a path segment with optional array indices.
parseJsonPath(String path) List<String>
Cleans and parses JSON paths.
throwIfNotValidJsonKey(String key) → void
Throws an ArgumentError if the given key is not a valid Dart identifier.

Typedefs

Json = Map<String, dynamic>
Shortcut for a JSON object
VisitProp = void Function(dynamic key, dynamic value, dynamic parent, List ancestors)
Callback invoked by JsonVisit.visit for each entry in a JSON document.
WhereProp = bool Function({String? key, String? path, dynamic value})
Filter method for Json.ls