Constructor and Description |
---|
JsonObject() |
Modifier and Type | Method and Description |
---|---|
JsonArray |
asArray() |
JsonBoolean |
asBoolean() |
JsonNumber |
asNumber() |
JsonObject |
asObject() |
JsonString |
asString() |
JsonObject |
copyDeeply()
Makes a full copy of the JSON data structure.
|
static JsonObject |
create() |
JsonValue |
get(String key) |
boolean |
isArray() |
boolean |
isBoolean() |
boolean |
isEmpty() |
boolean |
isNumber() |
boolean |
isObject() |
boolean |
isString() |
Iterator<Pair<String,JsonValue>> |
iterator() |
static JsonObject |
parse(Reader reader)
Creates a
JsonObject from a valid JSON string. |
void |
put(String key,
boolean val) |
void |
put(String key,
double val) |
void |
put(String key,
JsonValue val) |
void |
put(String key,
long val) |
void |
put(String key,
String val) |
void |
write(Writer writer) |
forEach, spliterator
public static JsonObject create()
public static JsonObject parse(Reader reader) throws JsonException, IOException
JsonObject
from a valid JSON string. This routine expects
the first non-whitespace character to be '{', then reads a single encoded
object from the Reader
and leaves the reader positioned after the
last '}' character.reader
- Reader
positioned to contain a JSON object encoded as
a string.JsonObject
on success, throws exception on failure.JsonException
- The input string is not in valid JSON format.IOException
- An IO error was encountered before all of the string
could be read.public JsonBoolean asBoolean()
public JsonNumber asNumber()
public JsonObject asObject()
public JsonString asString()
public JsonObject copyDeeply()
JsonValue
copyDeeply
in interface JsonValue
public boolean isEmpty()
public void put(String key, boolean val)
public void put(String key, double val)
public void put(String key, long val)
public void write(Writer writer) throws IOException
write
in interface JsonValue
IOException
Copyright © 2018. All rights reserved.