I have a class like this:
[serializable]
public class ComplexA{
public string A{get;set;}
public string B{get;set;}
public Foo Complex1 {get;set;}
}
[Serializable]
public class Foo{
public string Name{get;set;}
public Bar Prop1{get;set;}
}
[Serializable]
public class Bar{
public string A{get;set;}
public bool B{get;set;}
}
When creating the object of ComplexA and return it to the view (using an ajax call from jQuery), as a result I get somthing like this:
{
"A":"....",
"B":"...."
}
I am obtaining the object from a BusinessLayaer, and inspecting it from debug, all the properties has value. So I don't understand why not serializing the entire object.
My Action is like this:
[HttpPost]
public ActionResult GetData(){
var logic = new BL_Something();
ComplexA info = logic.GetData();
return Json(info);
}
So the result I am expecting is this:
{
"A":"...",
"B":"...",
"Complex1":{
"Name":"...",
"Prop1": {
"A":"....",
"B":"false"
}
}
FooinGetData()?