Open GoogleCodeExporter opened 9 years ago
Note: This is an enhancement (didn't see a setting for this).
Original comment by pacesysj...@gmail.com
on 8 Apr 2012 at 5:13
Original comment by limpbizkit
on 11 Apr 2012 at 8:33
It would be nice if it will be supported :)
http://stackoverflow.com/questions/12277765/it-is-possible-to-fill-current-objec
t-with-json-values-from-json
Original comment by KKoce...@gmail.com
on 12 Feb 2013 at 9:03
what is the plan for this enhancement? is it on the roadmap?
Original comment by dominik.mengelt
on 12 Nov 2013 at 1:34
I really like to see this enhancement. I am using the library in my Android
app. I have a ViewPager with existing items, when a page becomes visible, I
pull additional items remotely and I would like to populate the additional
fields in the existing items.
Original comment by tasoman...@gmail.com
on 26 Nov 2013 at 9:50
Any update on this?
Any chance that it will ever be implemented? any body have a nice work around?
I'm starting a new project and can choose to use Jackson vs GSON, and I'm
deeply interested in the ability to update existing instance rather than always
creating new instance.
I'm thinking of creating a new object and then merging to the existing one
using reflexion but I would rather have this handle at the deserialization
layer.
Original comment by hugues.b...@gmail.com
on 13 Jan 2015 at 10:26
See Inderjeet Singh's answer in this thread:
https://groups.google.com/d/msg/google-gson/q5e3VMHzxTo/DOivwaGC2XoJ
I use the InstanceCreator solution and it works very well. It is far from ideal
as it requires creating a new Gson instance every time, but it works quite well.
Here is my function :
public static <T> void populate(GsonBuilder builder, JsonObject json, Class<T> type, T into) {
builder.registerTypeAdapter(type, new InstanceCreator<T>() {
@Override public T createInstance(Type t) { return into; }
}).create().fromJson(json, type);
}
Original comment by timelza...@gmail.com
on 15 Jan 2015 at 2:51
Original issue reported on code.google.com by
pacesysj...@gmail.com
on 8 Apr 2012 at 5:12