We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
just tried to custom deserializer for object, and wrote the following code but it dosn't work:
JsonDeserializer<Object> objectJsonDeserializer = new JsonDeserializer<Object>() { @Override public Object deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { // can't reach this statement return null; } }; gsonBuilder.registerTypeAdapter(Object.class, objectJsonDeserializer);
and all other deserializers for other types like map, list, and custom class work fine.
The text was updated successfully, but these errors were encountered:
found the reason at
gson/gson/src/main/java/com/google/gson/Gson.java
Line 224 in 855f049
so it seems just impossible to override the builtin deserializer for object.
But I want to deserialize decimal as BigDecimal, interger as Long, array as ImmutableList, object as ImmutableMap when wirting something like
gsonBuilder.create().fromJson("string", Object.class);
Sorry, something went wrong.
duplicate of #1177.
No branches or pull requests
just tried to custom deserializer for object, and wrote the following code but it dosn't work:
and all other deserializers for other types like map, list, and custom class work fine.
The text was updated successfully, but these errors were encountered: