public interface Json
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Json.Array
Represents a parsed JSON array as a simple
int->value map. |
static interface |
Json.Object
Represents a parsed JSON object as a simple
string->value map. |
static interface |
Json.TypedArray<T>
A JSON array that assumes all values are of a uniform JSON type.
|
static interface |
Json.Writer
A
JsonSink that writes JSON to a string. |
| Modifier and Type | Method and Description |
|---|---|
Json.Array |
createArray()
Creates an new, empty
Json.Array. |
Json.Object |
createObject()
Creates an new, empty
Object. |
boolean |
isArray(java.lang.Object o)
Determines if the given object is a JSON
Json.Array. |
boolean |
isObject(java.lang.Object o)
Determines if the given object is a JSON
Object. |
Json.Writer |
newWriter()
Creates a new
Json.Writer, which can be used to serialize data into the JSON format. |
Json.Object |
parse(java.lang.String json)
Parses the given JSON string into an
Object that can be dynamically introspected. |
Json.Array |
parseArray(java.lang.String json)
Parses the given JSON string into an
Json.Array that can be dynamically introspected. |
Json.Array createArray()
Json.Array.Json.Object createObject()
Object.boolean isArray(java.lang.Object o)
Json.Array.boolean isObject(java.lang.Object o)
Object.Json.Writer newWriter()
Json.Writer, which can be used to serialize data into the JSON format.
// An example of using the JSON writer interface.
String jsonString = json.newWriter()
.object()
.value("x", 10)
.value("y", 10)
.object("nestedObject")
.value("id", "xyz123")
.end()
.array("nestedArray")
.value(1)
.value(2)
.value(3)
.value(4)
.value(5)
.end()
.end()
.done();
// Produces:
{
'x': 10,
'y': 10,
'nestedObject': {
'id': 'xyz123'
},
'nestedArray': [
1, 2, 3, 4, 5
]
}
Json.Object parse(java.lang.String json) throws playn.core.json.JsonParserException
Object that can be dynamically introspected.playn.core.json.JsonParserExceptionJson.Array parseArray(java.lang.String json) throws playn.core.json.JsonParserException
Json.Array that can be dynamically introspected.playn.core.json.JsonParserExceptionCopyright © 2018. All Rights Reserved.