Angular requires Date
objects in many places whereas JSON contains string representation of the date.
I want to add an array of properties which contain date values:
class Foo
{
public int IntProp {get;set;}
public DateTime? Prop1 {get;set;}
public DateTime Prop2 {get;set;}
public Bar Bar {set;set;}
}
class Bar
{
public DateTime Prop {get;set;}
public IEnumerable<DateTime?> Dates {get;set;}
}
Foo should then be serialized like this:
{
"IntProp": 1,
"Prop1": "...",
"Prop2": "...",
"Bar": {
"Prop": "..."
},
"<Dates>": [ "Prop1", "Prop2", "Bar.Prop", "Bar.Dates"]
}
This allows me to automatically convert strings to date objects at the client side without testing every property whether it is convertible to Date
like it is described in this question.
I can collect the paths of date properties, but have no idea how to add populated array to the root.