I have a JSON object that looks like this:
{
"Name": "John Smith"
"Age": 18
"Children" : [
{
"Name": "Little Johnny"
"Age": 4
"Children": []
}
]
}
My Model object looks like this
public class Person {
public string Name { get; set; }
public int Age { get; set; }
public IList<Person> Children { get; set; }
public Guid? TrackingKey { get; set; }
}
As you see the "TrackingKey" property is not a part of the JSON.
I want to have the TrackingKey property to be set with a value that I provide upon JSON deserialization.
The tracking key will be the same for the parent and all the children as well.
However it cannot be a static value that i could pass in with the DefaultValue attribute when I declare my model.
What would be the best way to assign The Tracking Key to a collection of parents and ALL their children?