public final class JSON extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
JSON.Array
Represents a JSON array.
|
static class |
JSON.Value
A single JSON value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(String key)
Checks if this object contains the given key.
|
static JSON |
empty()
Returns a
JSON of an empty document. |
JSON.Value |
get(String key)
Returns the
JSON.Value of the given key. |
Set<String> |
keySet()
Returns a set of all keys of this object.
|
static JSON |
parse(InputStream in)
Parses JSON from an
InputStream . |
static JSON |
parse(String json)
Parses JSON from a String.
|
String |
toString()
Returns the content as JSON string.
|
public static JSON parse(InputStream in) throws IOException
InputStream
.in
- InputStream
to read from. Will be closed after use.JSON
of the read content.IOException
public static JSON parse(String json)
json
- JSON stringJSON
of the read content.public boolean contains(String key)
key
- Name of the key to checktrue
if the key is presentpublic JSON.Value get(String key)
JSON.Value
of the given key.key
- Key to readJSON.Value
of the keyCopyright © 2015–2019. All rights reserved.