JsonToken enum
Enumerates all token types that a JsonParser can encounter during JSON parsing.
Tokens represent both structural and value-level elements within a JSON document, enabling fine-grained parsing control.
Example
if (parser.getCurrentToken() == JsonToken.VALUE_NUMBER) {
print('Found a number: ${parser.getCurrentValue()}');
}
Categories
- Structural tokens: START_OBJECT, END_OBJECT, START_ARRAY, END_ARRAY
- Field tokens: FIELD_NAME
- Value tokens: VALUE_STRING, VALUE_NUMBER, VALUE_BOOLEAN, VALUE_NULL
See also:
Values
- START_OBJECT → const JsonToken
-
Indicates the beginning of a JSON object (
{). - END_OBJECT → const JsonToken
-
Indicates the end of a JSON object (
}). - START_ARRAY → const JsonToken
-
Indicates the beginning of a JSON array (
[). - END_ARRAY → const JsonToken
-
Indicates the end of a JSON array (
]). - FIELD_NAME → const JsonToken
-
Represents a field name within a JSON object.
- VALUE_STRING → const JsonToken
-
Represents a string value.
- VALUE_NUMBER → const JsonToken
-
Represents a numeric value.
- VALUE_BOOLEAN → const JsonToken
-
Represents a boolean value (
trueorfalse). - VALUE_NULL → const JsonToken
-
Represents a null literal (
null).
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - 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