Skip to content
New issue

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

Custom Deserializers fail if the deserializer context is used on the source JsonElement #44

Closed
GoogleCodeExporter opened this issue Mar 19, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

Gson gets caught in infinite recursion if a client attempts to convert a
JSON string into a Java object of type Foo with the following
JsonDeserializer registered:

public static class FooTypeAdapter implements JsonDeserializer<Foo> {
  public Foo deserialize(JsonElement json, Type typeOfT,
JsonDeserializationContext context)
      throws JsonParseException {
    Foo fooObj = context.deserialize(json, typeOfT);
    fooObj.setExtraField("ThisIsExtra");
    return fooObj;
  }
}

Original issue reported on code.google.com by joel.leitch@gmail.com on 14 Sep 2008 at 7:58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant