Populate existing object
See original GitHub issueIt would be great is gson supported the population of existing objects. There
was a post a while back alluding to this behavior, but it doesn't exist now:
http://groups.google.com/group/google-gson/browse_thread/thread/ab97b754c1f3c53a
?pli=1
The rationale is that this would prevent users from having to create
TypeAdapters or InstanceCreators for every object that requires custom
construction, particularly since gson doesn't support the notion of a global
InstanceCreator at the moment.
Original issue reported on code.google.com by pacesysj...@gmail.com
on 8 Apr 2012 at 5:12
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:20 (1 by maintainers)
Top Results From Across the Web
Net Core 3.0 JsonSerializer populate existing object
//To populate an existing variable we will do so, we will create a variable with the pre existing data object ; //After this...
Read more >Populate an Object - Json.NET
This sample populates an existing object instance with values from JSON.
Read more >C# - Populate an existing object with JSON - MAKOLYTE
To populate this existing object with JSON, you can use the Newtonsoft method JsonConvert.PopulateObject():. using Newtonsoft.
Read more >Will JsonSerializer support parsing to existing object? #29538
Json supporting the equivalent of PopulateObject I have to jump through hoops with temporary instances and deep copies. I have it working for ......
Read more >C# – .Net Core 3.0 JsonSerializer populate existing object
Net Core 3.0 JsonSerializer populate existing object. asp.net-coreasp.net-core-3.0c++razor-pagessystem.text.json. I'm preparing a migration from ASP.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been looking for this functionality for years. @inder123 said “We are still searching for an elegant proposal.” What’s wrong with something like gson.fromJson(existingObject, json) ? I don’t see why it would not cover the same use cases as gson.fromJson(json).
You can implement this using InstanceCreators.