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)
| 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 |