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 java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private JsonEngine.Elementelementprivate static JsonEngineENGINEprotected static 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()java.lang.ObjectoptQuery(java.lang.String query)java.lang.ObjectoptQuery(JSONPointer query)java.lang.Objectquery(java.lang.String query)query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901java.lang.Objectquery(JSONPointer query)query the object graph using JSONPointer https://tools.ietf.org/html/rfc6901(package private) static java.lang.StringtoJson(JsonEngine.Element collection)(package private) static JsonEngine.ObjecttoJsonObject(java.util.Map map)protected static java.util.Map<java.lang.String,java.lang.Object>toMap(JsonEngine.Element obj)protected static java.lang.StringtoPrettyJson(JsonEngine.Element obj)(package private) static JsonEngine.ElementtoTree(java.lang.Object obj)java.io.Writerwrite(java.io.Writer sw)Write the JSON to a Writerjava.io.Writerwrite(java.io.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(package private) static voidwrite(JsonEngine.Element obj, java.io.Writer sw)
-
-
-
Field Detail
-
MAPPER
protected static final transient ToObjectMapper MAPPER
-
ENGINE
private static final transient JsonEngine ENGINE
-
element
private final JsonEngine.Element element
-
-
Constructor Detail
-
JSONElement
protected JSONElement(JsonEngine.Element e)
-
-
Method Detail
-
write
public java.io.Writer write(java.io.Writer sw) throws JSONExceptionWrite the JSON to a Writer- Parameters:
sw- the writer- Returns:
- the same Writer
- Throws:
JSONException- for IO problems
-
write
public java.io.Writer write(java.io.Writer sw, int indentFactor, int indent) throws JSONExceptionWrite 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 java.lang.Object query(java.lang.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 java.lang.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 java.lang.Object optQuery(java.lang.String query)
-
optQuery
public java.lang.Object optQuery(JSONPointer query)
-
getElement
public JsonEngine.Element getElement()
-
toJsonObject
static JsonEngine.Object toJsonObject(java.util.Map map)
-
toJson
static java.lang.String toJson(JsonEngine.Element collection)
-
toTree
static JsonEngine.Element toTree(java.lang.Object obj)
-
write
static void write(JsonEngine.Element obj, java.io.Writer sw)
-
toPrettyJson
protected static java.lang.String toPrettyJson(JsonEngine.Element obj)
-
toMap
protected static java.util.Map<java.lang.String,java.lang.Object> toMap(JsonEngine.Element obj)
-
-