This project has moved and is read-only. For the latest updates, please go here.

Including top level class name in serialize results

Jun 2, 2011 at 3:10 PM

I have a Json string : "{\"response\":{\"status\":9,\"profile\":{\"nickname\":\"9810\"}}}"; that I need to de-serialize using Json.Net.

I was hoping I could define the "root" class to be a "Response" object, containing the "Status" and "Profile" properties. However, it looks like this won't work.

I need to define one more parent to the "Response" object and define Response as a property on that parent:


class Parent


public Response response {get;set}



only then is Json.Net able to de-seriaize my string above correctly. Is there any way to avoid defining the additional parent class?