MCPcopy Index your code
hub / github.com/google/gson / toJsonTree

Method toJsonTree

src/main/java/com/google/gson/Gson.java:193–198  ·  view source on GitHub ↗

This method serializes the specified object into its equivalent representation as a tree of JsonElements. This method should be used when the specified object is not a generic type. This method uses Class#getClass() to get the type for the specified object, but the getClass()

(Object src)

Source from the content-addressed store, hash-verified

191 * @since 1.4
192 */
193 public JsonElement toJsonTree(Object src) {
194 if (src == null) {
195 return JsonNull.createJsonNull();
196 }
197 return toJsonTree(src, src.getClass());
198 }
199
200 /**
201 * This method serializes the specified object, including those of generic types, into its

Calls 2

createJsonNullMethod · 0.95
serializeMethod · 0.95