public interface JSON
extends java.io.Serializable
JSONObject
, a JSONArray
or a
JSONNull
.Modifier and Type | Method and Description |
---|---|
boolean |
isArray()
Returns true if this object is a JSONArray, false otherwise.
|
boolean |
isEmpty()
Returns true if this object has no elements or keys.
|
int |
size()
Returns the number of properties in an object or the size of the array.
|
java.lang.String |
toString(int indentFactor)
Make a prettyprinted JSON text.
|
java.lang.String |
toString(int indentFactor,
int indent)
Make a prettyprinted JSON text.
|
java.io.Writer |
write(java.io.Writer writer)
Write the contents as JSON text to a writer.
|
java.io.Writer |
writeCanonical(java.io.Writer w)
Writes the canonicalized form of this JSON object.
|
boolean isArray()
boolean isEmpty()
JSONException
- if called on a 'null' objectint size()
JSONException
- if called on a 'null' objectjava.lang.String toString(int indentFactor)
Warning: This method assumes that the data structure is acyclical.
indentFactor
- The number of spaces to add to each level of
indentation.{
(left
brace) and ending with }
(right
brace).JSONException
- If the object contains an invalid number.java.lang.String toString(int indentFactor, int indent)
Warning: This method assumes that the data structure is acyclical.
indentFactor
- The number of spaces to add to each level of
indentation.indent
- The indentation of the top level.{
(left brace)
and ending with }
(right brace).JSONException
- If the object contains an invalid number.java.io.Writer write(java.io.Writer writer) throws java.io.IOException
Warning: This method assumes that the data structure is acyclical.
JSONException
java.io.IOException
java.io.Writer writeCanonical(java.io.Writer w) throws java.io.IOException
java.io.IOException
Copyright © 2006-2013 Json-lib. All Rights Reserved.