Package javax.json
Interface JsonValue
- All Known Subinterfaces:
JsonArray
,JsonNumber
,JsonObject
,JsonString
,JsonStructure
public interface JsonValue
JsonValue
represents an immutable JSON value.
A JSON value is one of the following:
an object (JsonObject
), an array (JsonArray
),
a number (JsonNumber
), a string (JsonString
),
true
(JsonValue.TRUE
), false
(JsonValue.FALSE
),
or null
(JsonValue.NULL
).
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final JsonArray
The empty JSON array.static final JsonObject
The empty JSON object.static final JsonValue
JSON false value.static final JsonValue
JSON null value.static final JsonValue
JSON true value. -
Method Summary
Modifier and TypeMethodDescriptiondefault JsonArray
Return the JsonValue as a JsonArraydefault JsonObject
Return the JsonValue as a JsonObjectReturns the value type of this JSON value.toString()
Returns JSON text for this JSON value.
-
Field Details
-
EMPTY_JSON_OBJECT
The empty JSON object.- Since:
- 1.1
-
EMPTY_JSON_ARRAY
The empty JSON array.- Since:
- 1.1
-
NULL
JSON null value. -
TRUE
JSON true value. -
FALSE
JSON false value.
-
-
Method Details
-
getValueType
JsonValue.ValueType getValueType()Returns the value type of this JSON value.- Returns:
- JSON value type
-
asJsonObject
Return the JsonValue as a JsonObject- Returns:
- the JsonValue as a JsonObject
- Throws:
ClassCastException
- if the JsonValue is not a JsonObject- Since:
- 1.1
-
asJsonArray
Return the JsonValue as a JsonArray- Returns:
- the JsonValue as a JsonArray
- Throws:
ClassCastException
- if the JsonValue is not a JsonArray- Since:
- 1.1
-
toString
String toString()Returns JSON text for this JSON value.
-