Suppose you have the following class:
public class Class1
{
public int a;
}
Then, you serialize the class and save it on your database as JSON.
Then, you convert the JSON format back into a Class1
instance.
However Class1
is subject to change: meaning the properties could be named differently or having new ones added to my class.
Example of modified Class1:
public class Class1
{
public int a;
public int b;
}
What I'd like to do is keep all of the existing properties I grab from my JSON, while also initializing the new ones.
Keep in mind that Class1
is just an example, and the actual class is going to have many nested objects.
I thought about creating a new instance, but I'm not too sure how to update every property (because some of them are going to be nested, and among them, only some have actually been modified).