Package com.arcadedb.serializer.json
Class JSONObject
- java.lang.Object
-
- com.arcadedb.serializer.json.JSONObject
-
public class JSONObject extends Object
JSON object.
This API is compatible with org.json Java API, but uses Google GSON library under the hood. The main reason why we created this wrapper is because the maintainer of the project org.json are not open to support ordered attributes as an option.- Author:
- Luca Garulli ([email protected])
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.gson.JsonNull
NULL
-
Constructor Summary
Constructors Constructor Description JSONObject()
JSONObject(com.google.gson.JsonObject input)
JSONObject(String input)
JSONObject(Map<String,?> map)
-
Method Summary
-
-
-
Method Detail
-
put
public JSONObject put(String name, String value)
-
put
public JSONObject put(String name, Number value)
-
put
public JSONObject put(String name, Boolean value)
-
put
public JSONObject put(String name, Character value)
-
put
public JSONObject put(String name, Object value)
-
getFloat
public float getFloat(String name)
-
getDouble
public double getDouble(String name)
-
getBigDecimal
public BigDecimal getBigDecimal(String name)
-
getJSONObject
public JSONObject getJSONObject(String name)
-
has
public boolean has(String name)
-
names
public JSONArray names()
-
length
public int length()
-
getInternal
public com.google.gson.JsonElement getInternal()
-
toString
public String toString(int indent)
-
isEmpty
public boolean isEmpty()
-
clear
public void clear()
-
isNull
public boolean isNull(String name)
-
write
public void write(FileWriter writer) throws IOException
- Throws:
IOException
-
setDateFormat
public JSONObject setDateFormat(String dateFormat)
Sets the format for dates. Null means using the timestamp, otherwise it follows the syntax of Java SimpleDateFormat.- Returns:
-
elementToObject
protected static Object elementToObject(com.google.gson.JsonElement element)
-
objectToElement
protected static com.google.gson.JsonElement objectToElement(Object object)
-
-