Package kong.unirest.core.json
Class JSONElement
- java.lang.Object
-
- kong.unirest.core.json.JSONElement
-
- Direct Known Subclasses:
JSONArray,JSONObject
public abstract class JSONElement extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static kong.unirest.core.json.ToObjectMapperMAPPER
-
Constructor Summary
Constructors Modifier Constructor Description protectedJSONElement(JsonEngine.Element e)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonEngine.ElementgetElement()ObjectoptQuery(String query)ObjectoptQuery(JSONPointer query)Objectquery(String query)query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901Objectquery(JSONPointer query)query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901protected static Map<String,Object>toMap(JsonEngine.Element obj)protected static StringtoPrettyJson(JsonEngine.Element obj)Writerwrite(Writer sw)Write the JSON to a WriterWriterwrite(Writer sw, int indentFactor, int indent)Write the JSON to a Writer with a pretty format due to limitations in GSON the index and indent are currently ignored
-
-
-
Constructor Detail
-
JSONElement
protected JSONElement(JsonEngine.Element e)
-
-
Method Detail
-
write
public Writer write(Writer sw) throws JSONException
Write the JSON to a Writer- Parameters:
sw- the writer- Returns:
- the same Writer
- Throws:
JSONException- for IO problems
-
write
public Writer write(Writer sw, int indentFactor, int indent) throws JSONException
Write the JSON to a Writer with a pretty format due to limitations in GSON the index and indent are currently ignored- Parameters:
sw- the writerindentFactor- currently ignoredindent- currently ignored- Returns:
- the same Writer
- Throws:
JSONException- for IO problems
-
query
public Object query(String query)
query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901- Parameters:
query- the pointer to get- Returns:
- the thing you asked for
-
query
public Object query(JSONPointer query)
query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901- Parameters:
query- the pointer to get- Returns:
- the thing you asked for
-
optQuery
public Object optQuery(JSONPointer query)
-
getElement
public JsonEngine.Element getElement()
-
toPrettyJson
protected static String toPrettyJson(JsonEngine.Element obj)
-
toMap
protected static Map<String,Object> toMap(JsonEngine.Element obj)
-
-