Package com.sdicons.json.model
Class JSONObject
- java.lang.Object
-
- com.sdicons.json.model.JSONValue
-
- com.sdicons.json.model.JSONComplex
-
- com.sdicons.json.model.JSONObject
-
public class JSONObject extends JSONComplex
Representation of a JSON object, a collection (unordered) of name/value pairs. An example:{"name":"Homer", "age":40, "children":["Bart", "Maggie", "Lisa"]}
-
-
Constructor Summary
Constructors Constructor Description JSONObject()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(java.lang.String aKey)
boolean
equals(java.lang.Object o)
JSONValue
get(java.lang.String aKey)
Utility method, get the element with specified name without having to retreive the map first using getValue().java.util.HashMap<java.lang.String,JSONValue>
getValue()
int
hashCode()
protected java.lang.String
render(boolean aPretty, java.lang.String aIndent)
Convert the JSON value into a string representation (JSON representation).int
size()
java.lang.Object
strip()
Remove all JSON related information.java.lang.String
toString()
-
-
-
Field Detail
-
map
private java.util.HashMap<java.lang.String,JSONValue> map
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in classJSONComplex
-
getValue
public java.util.HashMap<java.lang.String,JSONValue> getValue()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
render
protected java.lang.String render(boolean aPretty, java.lang.String aIndent)
Description copied from class:JSONValue
Convert the JSON value into a string representation (JSON representation).
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
containsKey
public boolean containsKey(java.lang.String aKey)
-
get
public JSONValue get(java.lang.String aKey)
Utility method, get the element with specified name without having to retreive the map first using getValue().- Parameters:
aKey
- The key for which you want to retrieve the element.- Returns:
- The element corresponding to the key or null if the object does not contain a key with this name.
-
-