Uses of Class
com.google.gson.JsonElement
-
Packages that use JsonElement Package Description com.google.gson This package provides theGson
class to convert Json to Java and vice-versa. -
-
Uses of JsonElement in com.google.gson
Subclasses of JsonElement in com.google.gson Modifier and Type Class Description class
JsonArray
A class representing an array type in JSON.class
JsonNull
A class representing a JSONnull
value.class
JsonObject
A class representing an object type in Json.class
JsonPrimitive
A class representing a JSON primitive value.Methods in com.google.gson that return JsonElement Modifier and Type Method Description abstract JsonElement
JsonElement. deepCopy()
Returns a deep copy of this element.JsonElement
JsonArray. get(int i)
Returns the i-th element of the array.JsonElement
JsonObject. get(String memberName)
Returns the member with the specified name.JsonElement
JsonStreamParser. next()
Returns the next availableJsonElement
on the reader.JsonElement
JsonParser. parse(JsonReader json)
Deprecated.JsonElement
JsonParser. parse(Reader json)
Deprecated.JsonElement
JsonParser. parse(String json)
Deprecated.static JsonElement
JsonParser. parseReader(JsonReader reader)
Returns the next value from the JSON stream as a parse tree.static JsonElement
JsonParser. parseReader(Reader reader)
Parses the complete JSON string provided by the reader into a parse tree.static JsonElement
JsonParser. parseString(String json)
Parses the specified JSON string into a parse tree.JsonElement
JsonArray. remove(int index)
Removes the element at the specified position in this array.JsonElement
JsonObject. remove(String property)
Removes theproperty
from this object.JsonElement
JsonSerializationContext. serialize(Object src)
Invokes default serialization on the specified object.JsonElement
JsonSerializationContext. serialize(Object src, Type typeOfSrc)
Invokes default serialization on the specified object passing the specific type information.JsonElement
JsonSerializer. serialize(T src, Type typeOfSrc, JsonSerializationContext context)
Gson invokes this call-back method during serialization when it encounters a field of the specified type.abstract JsonElement
LongSerializationPolicy. serialize(Long value)
Serialize thisvalue
using this serialization policy.JsonElement
JsonArray. set(int index, JsonElement element)
Replaces the element at the specified position in this array with the specified element.JsonElement
Gson. toJsonTree(Object src)
This method serializes the specified object into its equivalent representation as a tree ofJsonElement
s.JsonElement
Gson. toJsonTree(Object src, Type typeOfSrc)
This method serializes the specified object, including those of generic types, into its equivalent representation as a tree ofJsonElement
s.JsonElement
TypeAdapter. toJsonTree(T value)
Convertsvalue
to a JSON tree.Methods in com.google.gson that return types with arguments of type JsonElement Modifier and Type Method Description List<JsonElement>
JsonArray. asList()
Returns a mutableList
view of thisJsonArray
.Map<String,JsonElement>
JsonObject. asMap()
Returns a mutableMap
view of thisJsonObject
.Set<Map.Entry<String,JsonElement>>
JsonObject. entrySet()
Returns a set of members of this object.Iterator<JsonElement>
JsonArray. iterator()
Returns an iterator to navigate the elements of the array.Methods in com.google.gson with parameters of type JsonElement Modifier and Type Method Description void
JsonArray. add(JsonElement element)
Adds the specified element to self.void
JsonObject. add(String property, JsonElement value)
Adds a member, which is a name-value pair, to self.boolean
JsonArray. contains(JsonElement element)
Returns true if this array contains the specified element.<T> T
JsonDeserializationContext. deserialize(JsonElement json, Type typeOfT)
Invokes default deserialization on the specified object.T
JsonDeserializer. deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
Gson invokes this call-back method during deserialization when it encounters a field of the specified type.<T> T
Gson. fromJson(JsonElement json, TypeToken<T> typeOfT)
This method deserializes the JSON read from the specified parse tree into an object of the specified type.<T> T
Gson. fromJson(JsonElement json, Class<T> classOfT)
This method deserializes the JSON read from the specified parse tree into an object of the specified type.<T> T
Gson. fromJson(JsonElement json, Type typeOfT)
This method deserializes the JSON read from the specified parse tree into an object of the specified type.T
TypeAdapter. fromJsonTree(JsonElement jsonTree)
ConvertsjsonTree
to a Java object.boolean
JsonArray. remove(JsonElement element)
Removes the first occurrence of the specified element from this array, if it is present.JsonElement
JsonArray. set(int index, JsonElement element)
Replaces the element at the specified position in this array with the specified element.String
Gson. toJson(JsonElement jsonElement)
Converts a tree ofJsonElement
s into its equivalent JSON representation.void
Gson. toJson(JsonElement jsonElement, JsonWriter writer)
Writes the JSON forjsonElement
towriter
.void
Gson. toJson(JsonElement jsonElement, Appendable writer)
Writes out the equivalent JSON for a tree ofJsonElement
s.
-