ArrayNode class final
A JSON array: an ordered list of child nodes, which can be changed in place.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isArray → bool
-
Whether this is an ArrayNode.
no setteroverride
- isBoolean → bool
-
Whether this is a BooleanNode.
no setterinherited
- isContainer → bool
-
Whether this is an object or an array.
no setterinherited
- isEmpty → bool
-
Whether the object or array has no children (
truefor other nodes).no setterinherited - isIntegralNumber → bool
-
Whether this is a number without a fraction.
no setterinherited
- isMissingNode → bool
-
Whether this is the MissingNode.
no setterinherited
- isNull → bool
-
Whether this is the NullNode.
no setterinherited
- isNumber → bool
-
Whether this is a NumericNode.
no setterinherited
- isObject → bool
-
Whether this is an ObjectNode.
no setterinherited
- isString → bool
-
Whether this is a StringNode.
no setterinherited
- isValueNode → bool
-
Whether this is a string, number, boolean or
null.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
The number of properties of an object or elements of an array; 0
for other nodes.
no setteroverride
Methods
-
add(
Object? value) → ArrayNode -
Appends
value, decoded JSON or a JsonNode, and returns this array. -
addArray(
) → ArrayNode - Appends an empty array and returns it.
-
addObject(
) → ObjectNode - Appends an empty object and returns it.
-
asBoolean(
[bool? defaultValue]) → bool -
The value as a bool: a boolean,
"true"/"false", a number (not 0),falsefornulland a missing node; anything else givesdefaultValue, or throws a JsonNodeException without one.inherited -
asDouble(
[double? defaultValue]) → double -
The value as a double, converted like asInt (a string may be any
number,
"1.5").inherited -
asInt(
[int? defaultValue]) → int -
The value as an int (Jackson 3): a finite number (truncated), a
string of an integer (
"42"), a boolean (1 / 0), 0 fornulland a missing node. Anything else givesdefaultValue, or throws a JsonNodeException without one;nulland a missing node givedefaultValuewhen there is one.inherited -
asString(
[String? defaultValue]) → String -
The value as a string (Jackson 3): the text of a string, number or
boolean,
''fornulland a missing node. An object or array givesdefaultValue, or throws a JsonNodeException without one;nulland a missing node givedefaultValuewhen there is one.inherited -
at(
String pointer) → JsonNode -
Returns the node at the JSON Pointer
pointer(/book/tags/0;~1stands for/,~0for~), or a MissingNode when there is none. An empty pointer gives this node; one not starting with/throws an ArgumentError.inherited -
booleanValue(
) → bool -
Returns the value of a BooleanNode; throws a JsonNodeException
for other nodes.
inherited
-
deepCopy(
) → JsonNode -
Returns a copy that shares no objects or arrays with this node, so
it can be changed independently.
inherited
-
doubleValue(
) → double -
Returns the value of a NumericNode as a double; throws a
JsonNodeException for other nodes.
inherited
-
get(
Object nameOrIndex) → JsonNode? -
The property
nameOrIndexof an object, or the element at indexnameOrIndexof an array;nullwhen there is none.override -
has(
Object nameOrIndex) → bool -
Whether get finds a node for
nameOrIndex.inherited -
insert(
int index, Object? value) → ArrayNode -
Inserts
valueatindexand returns this array. -
intValue(
) → int -
The value of a NumericNode as an int, when it is one exactly;
throws a JsonNodeException for a fraction (
1.5), NaN, infinity and other nodes.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
numberValue(
) → num -
Returns the value of a NumericNode; throws a JsonNodeException
for other nodes.
inherited
-
path(
Object nameOrIndex) → JsonNode -
Like get, but a MissingNode instead of
null, so paths can be chained:root.path('a').path('b').inherited -
properties(
) → Iterable< MapEntry< String, JsonNode> > -
The properties of an object as name/node entries, in order; empty
for other nodes.
inherited
-
propertyNames(
) → Iterable< String> -
The property names of an object, in order; empty for other nodes.
inherited
-
remove(
int index) → JsonNode -
Removes the element at
indexand returns it. -
set(
int index, Object? value) → JsonNode -
Replaces the element at
indexwithvalueand returns the old one. -
stringValue(
) → String -
Returns the text of a StringNode; throws a JsonNodeException for
other nodes. Use asString to convert instead.
inherited
-
toJson(
) → List< Object?> -
Returns this node as plain decoded JSON:
null, a bool, number, string, list or map, asjsonEncodetakes it (MissingNode givesnull).override -
toPrettyString(
) → String -
This node as JSON text indented by two spaces, for people to read.
inherited
-
toString(
) → String -
This node as compact JSON text.
inherited
-
values(
) → Iterable< JsonNode> -
The elements of an array or the property values of an object; empty
for other nodes.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited