DataTable to JSON [duplicate]

Solution 1:

Would it help you convince your bosses to install a library if it's Microsoft's AJAX extensions for .NET 2.0?

Included in them is System.Web.Script.Serialization.JavascriptSerializer, which is used in Step 4 of the last link in your post.

Solution 2:

Hey budy, its is all here in Rick's blog post Serializing DataTable using Json.NET. He explains in detail how you can accomplish it using Json.NET from James Newton King.

Solution 3:

I found this: http://www.bramstein.com/projects/xsltjson/ You can convert your datatable to xml and use a xslt stylesheet to convert the xml to json.

It is more a workaround than a real solution.