- How would you create this Json object from my ASP.Net MVC 3 Controller ?
-
Newbie in Json, in this Json object notation, can I replace the
[and]sign with{and}?var data = [ { label: 'node1', children: [ { label: 'child1' }, { label: 'child2' } ] }, { label: 'node2', children: [ { label: 'child3' } ] } ];
Thanks
you have the JavascriptSerializer object in .NET which can serialize most types
see:
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
and no you can’t replace [ with { (obviously you can but almost all desrializers of JSON apart from something you wrote yourself wouldn’t then understand the data)