JsonPath class

A dotted path into a decoded JSON tree.

Used by dataKey, paginationKey and ErrorDescription.key so a payload can be reached at any depth rather than one level:

dataKey: 'data.items'            // {"data": {"items": [...]}}
dataKey: 'data.pages[0].items'   // list indices are supported
dataKey: r'meta.user\.name'      // a backslash escapes a literal dot
dataKey: ''                      // empty path means the whole body

A single key with no dots — the common case — behaves exactly as it always has, so existing dataKey: 'data' values need no change.

Constructors

JsonPath.parse(String raw)

Properties

hashCode int
The hash code for this object.
no setterinherited
isRoot bool
True when this path selects the root, i.e. it was empty.
no setter
raw String
The path as written.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
segments List<Object>
String map keys and int list indices, in order.
final

Methods

describePrefix(int index) String
Renders the path up to and including segment index, for diagnostics.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(dynamic root) JsonPathResult
Walks root one segment at a time, reporting where it stopped.
toString() String
A string representation of this object.
override

Operators

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