Interface JSONObjects
-
public interface JSONObjects
API for creating in memory JSON Object representations, and for serializing in memory Object Graphs to JSON representations.- Author:
- cdivilly
-
<section role="region">
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JSONArray.Builder
array()
Create a newJSONArray.Builder
instanceJSONObject.Builder
object()
Create a newJSONObject.Builder
instanceJSONNode
read(java.io.InputStream stream)
Parse a byte stream into aJSONObject
orJSONArray
instanceJSONNode
read(java.io.Reader stream)
Parse a character stream into aJSONObject
orJSONArray
instanceJSONNode
read(java.lang.CharSequence text)
Parse a character stream into aJSONObject
orJSONArray
instanceJSONNode
read(java.util.Iterator<JSONToken> stream)
Parse a JSONToken stream into aJSONObject
orJSONArray
instancevoid
write(java.io.OutputStream stream, java.lang.Object objectGraph)
Serialize any Java Object graph to it's textual representation.void
write(java.io.OutputStream stream, JSONNode node)
Serialize a JSON Object graph to it's textual representationvoid
write(java.lang.Appendable stream, java.lang.Object objectGraph)
Serialize any Java Object graph to it's textual representation.void
write(java.lang.Appendable stream, JSONNode node)
Serialize a JSON Object graph to it's textual representationvoid
write(JSONWriter stream, java.lang.Object objectGraph)
Serialize any Java Object graph to aJSONWriter
stream.void
write(JSONWriter stream, JSONNode node)
Serialize a JSON Object graph to aJSONWriter
stream
-
-
<section role="region">
-
Method Detail
-
array
JSONArray.Builder array()
Create a newJSONArray.Builder
instance- Returns:
JSONArray.Builder
instance
-
object
JSONObject.Builder object()
Create a newJSONObject.Builder
instance- Returns:
JSONObject.Builder
instance
-
read
JSONNode read(java.lang.CharSequence text)
Parse a character stream into aJSONObject
orJSONArray
instance- Parameters:
text
- The JSON textual representation to be parsed- Returns:
JSONObject
orJSONArray
instance
-
read
JSONNode read(java.io.InputStream stream) throws JSONIOException
Parse a byte stream into aJSONObject
orJSONArray
instance- Parameters:
stream
- The JSON textual representation to be parsed- Returns:
JSONObject
orJSONArray
instance- Throws:
JSONIOException
- if anIOException
occurs reading from the stream
-
read
JSONNode read(java.util.Iterator<JSONToken> stream) throws JSONIOException
Parse a JSONToken stream into aJSONObject
orJSONArray
instance- Parameters:
stream
- TheJSONToken
stream to be parsed- Returns:
JSONObject
orJSONArray
instance- Throws:
JSONIOException
- if anIOException
occurs reading from the stream
-
read
JSONNode read(java.io.Reader stream) throws JSONIOException
Parse a character stream into aJSONObject
orJSONArray
instance- Parameters:
stream
- The JSON textual representation to be parsed- Returns:
JSONObject
orJSONArray
instance if anIOException
occurs reading from the stream- Throws:
JSONIOException
-
write
void write(java.lang.Appendable stream, JSONNode node) throws JSONIOException
Serialize a JSON Object graph to it's textual representation- Parameters:
stream
- The character stream to serialize tonode
- TheJSONObject
orJSONNode
at the root of the object graph- Throws:
JSONIOException
- if an IO error occurs
-
write
void write(java.lang.Appendable stream, java.lang.Object objectGraph) throws JSONIOException
Serialize any Java Object graph to it's textual representation.
- Parameters:
stream
- The character stream to serialize toobjectGraph
- The root node in the object graph- Throws:
JSONIOException
- if an IO error occurs- See Also:
- Serializing Java Object Graphs
-
write
void write(JSONWriter stream, JSONNode node) throws JSONIOException
Serialize a JSON Object graph to aJSONWriter
stream- Parameters:
stream
- TheJSONWriter
stream to serialize tonode
- TheJSONObject
orJSONNode
at the root of the object graph- Throws:
JSONIOException
- if an IO error occurs
-
write
void write(JSONWriter stream, java.lang.Object objectGraph) throws JSONIOException
Serialize any Java Object graph to a
JSONWriter
stream.- Parameters:
stream
- TheJSONWriter
stream to serialize toobjectGraph
- The root node in the object graph- Throws:
JSONIOException
- if an IO error occurs- See Also:
- Serializing Java Object Graphs
-
write
void write(java.io.OutputStream stream, JSONNode node) throws JSONIOException
Serialize a JSON Object graph to it's textual representation- Parameters:
stream
- The byte stream to serialize tonode
- TheJSONObject
orJSONNode
at the root of the object graph- Throws:
JSONIOException
- if an IO error occurs
-
write
void write(java.io.OutputStream stream, java.lang.Object objectGraph) throws JSONIOException
Serialize any Java Object graph to it's textual representation.
- Parameters:
stream
- The byte stream to serialize toobjectGraph
- The root node in the object graph- Throws:
JSONIOException
- if an IO error occurs- See Also:
- Serializing Java Object Graphs
-
-