Nested Object

Apr 14, 2010 at 7:59 PM

I am having a problem deserializing nested objects. Get a null reference exception (see sample)

string json =

@"{

"name":"Good Day",

"description":"I said Good Day!",

"As":[

{

"name":"Fez",

"description":"Foreign Kid"

},

{

"name":"Michael",

"description":"Idiot"

},

 

]

}"

Class A

{

string name{get;}

string description{get;}

private A(){}

public A (string name, string description) {...}

}

Class B

{

string name{get;}

string description{get;}

List<A> As{get;}

public B () {}

public B (string name, string description) {...}

}

class foo

{

void main()

{

B myB = new B();

JsonConvert.Populate(json, this);

}

}