MCPcopy
hub / github.com/google/gson / JsonDeserializer

Interface JsonDeserializer

gson/src/main/java/com/google/gson/JsonDeserializer.java:76–95  ·  gson/src/main/java/com/google/gson/JsonDeserializer.java::JsonDeserializer

Interface representing a custom deserializer for JSON. You should write a custom deserializer, if you are not happy with the default deserialization done by Gson. You will also need to register this deserializer through {@link GsonBuilder#registerTypeAdapter(Type, Object)}. <p>Let us look at exampl

Source from the content-addressed store, hash-verified

74 * deserializer may be asked to deserialize a specific generic type of the T.
75 */
76public interface JsonDeserializer<T> {
77
78 /**
79 * Gson invokes this call-back method during deserialization when it encounters a field of the
80 * specified type.
81 *
82 * <p>In the implementation of this call-back method, you should consider invoking {@link
83 * JsonDeserializationContext#deserialize(JsonElement, Type)} method to create objects for any
84 * non-trivial field of the returned object. However, you should never invoke it on the same type
85 * passing {@code json} since that will cause an infinite loop (Gson will call your call-back
86 * method again).
87 *
88 * @param json The Json data being deserialized
89 * @param typeOfT The type of the Object to deserialize to
90 * @return a deserialized object of the specified type typeOfT which is a subclass of {@code T}
91 * @throws JsonParseException if json is not in the expected format of {@code typeOfT}
92 */
93 T deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
94 throws JsonParseException;
95}

Callers 8

deserializeMethod · 0.65
deserializeMethod · 0.65
deserializeMethod · 0.65
excludeFieldMethod · 0.65
readMethod · 0.65
readMethod · 0.65

Implementers 15

ProtoTypeAdapterproto/src/main/java/com/google/gson/pr
MyParameterizedTypeAdaptergson/src/test/java/com/google/gson/Par
ExceptionTypeAdaptergson/src/test/java/com/google/gson/Gso
AtomicIntegerTypeAdaptergson/src/test/java/com/google/gson/Gso
CrazyLongTypeAdaptergson/src/test/java/com/google/gson/com
Adaptergson/src/test/java/com/google/gson/fun
DataHolderDeserializergson/src/test/java/com/google/gson/fun
MyEnumTypeAdaptergson/src/test/java/com/google/gson/fun
UserDeserializergson/src/test/java/com/google/gson/fun
UserSerializerDeserializergson/src/test/java/com/google/gson/fun
UserSerializerDeserializer2gson/src/test/java/com/google/gson/fun
FooTypeAdaptergson/src/test/java/com/google/gson/fun

Calls

no outgoing calls

Tested by

no test coverage detected