Display formatted JSON in the view in ASP.NET MVC

illspirit

New Member
Is there a way to format JSON to be displayed in the view? This way when I add a new property my API documentation will be updated automatically? Extra credit would be to surround certain elements with CSS to style it. I would also like to do this for XML.\[code\]class Student { static CreateEmpty() { return new Student() { FirstName: 'Mike', LastName: 'Flynn', Classes: new List<Class>(), School: new School() { Name: 'High School' } } }}<code>@(Student.CreateEmpty().ToJSON())</code>\[/code\]to\[code\]<code>{ FirstName: 'Mike', LastName: 'Flynn', Classes: [], School: { Name: 'High School' }}</code>\[/code\]
 
Back
Top