java.lang.Object
org.shredzone.acme4j.toolbox.JSON
- All Implemented Interfaces:
Serializable
A model containing a JSON result. The content is immutable.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents a JSON array.static final classA single JSON value. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this object contains the given key.static JSONempty()Returns aJSONof an empty document.Returns theJSON.Valueof the given key.keySet()Returns a set of all keys of this object.static JSONparse(InputStream in) Parses JSON from anInputStream.static JSONParses JSON from a String.toMap()Returns the content as unmodifiable Map.toString()Returns the content as JSON string.
-
Method Details
-
parse
Parses JSON from anInputStream.- Parameters:
in-InputStreamto read from. Will be closed after use.- Returns:
JSONof the read content.- Throws:
IOException
-
parse
Parses JSON from a String.- Parameters:
json- JSON string- Returns:
JSONof the read content.
-
empty
Returns aJSONof an empty document.- Returns:
- Empty
JSON
-
keySet
Returns a set of all keys of this object.- Returns:
Setof keys
-
contains
Checks if this object contains the given key.- Parameters:
key- Name of the key to check- Returns:
trueif the key is present
-
get
Returns theJSON.Valueof the given key.- Parameters:
key- Key to read- Returns:
JSON.Valueof the key
-
toString
Returns the content as JSON string. -
toMap
Returns the content as unmodifiable Map.- Since:
- 2.8
-