no. you get the A and B by defining them as the property name of an anonymous, not types. also not sure why you use generic when Data is an object, just use:
public class DataWrapper
{
public object Data {get;set;}
}
...
var g1 = new DataWrapper
{
Data = new
{
A = lstA,
validation = null as ValidationError
}
};
or if you just want to json serialize g1, no wrapper class required:
var g1 = new
{
Data = new
{
A = lstA,
validation = null as ValidationError
}
};