Package elemental.json
Interface JsonObject
-
- All Superinterfaces:
JsonValue
,Serializable
- All Known Implementing Classes:
JreJsonObject
public interface JsonObject extends JsonValue
Represents a Json object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends JsonValue>
Tget(String key)
Return the element (uncoerced) as a JsonValue.JsonArray
getArray(String key)
Return the element (uncoerced) as a JsonArray.boolean
getBoolean(String key)
Return the element (uncoerced) as a boolean.double
getNumber(String key)
Return the element (uncoerced) as a number.JsonObject
getObject(String key)
Return the element (uncoerced) as a JsonObject If the type is not an object,, this can result in runtime errors.String
getString(String key)
Return the element (uncoerced) as a String.boolean
hasKey(String key)
Test whether a given key has present.String[]
keys()
All keys of the object.void
put(String key, boolean bool)
Set a given key to the given boolean value.void
put(String key, double value)
Set a given key to the given double value.void
put(String key, JsonValue value)
Set a given key to the given value.void
put(String key, String value)
Set a given key to the given String value.void
remove(String key)
Remove a given key and associated value from the object.
-
-
-
Method Detail
-
getArray
JsonArray getArray(String key)
Return the element (uncoerced) as a JsonArray. If the type is not an array, this can result in runtime errors.
-
getBoolean
boolean getBoolean(String key)
Return the element (uncoerced) as a boolean. If the type is not a boolean, this can result in runtime errors.
-
getNumber
double getNumber(String key)
Return the element (uncoerced) as a number. If the type is not a number, this can result in runtime errors.
-
getObject
JsonObject getObject(String key)
Return the element (uncoerced) as a JsonObject If the type is not an object,, this can result in runtime errors.
-
getString
String getString(String key)
Return the element (uncoerced) as a String. If the type is not a String, this can result in runtime errors.
-
keys
String[] keys()
All keys of the object.
-
put
void put(String key, double value)
Set a given key to the given double value.
-
put
void put(String key, boolean bool)
Set a given key to the given boolean value.
-
hasKey
boolean hasKey(String key)
Test whether a given key has present.
-
remove
void remove(String key)
Remove a given key and associated value from the object.- Parameters:
key
-
-
-