views:

3792

answers:

2

Hi All...

I have been searching for a simple way to convert a dataset from a postgres database to JSON for use in a project that i am building. This is my first time using JSON and I have found it really tricky to find a simple way of doing this. I have been using a stringbuilder at the moment to create a JSON string from the information in the dataset, but i have heard that it is possible to do this very simply with .net 3.5 using the system.runtime.serialization namespace, though I have yet to find a simple article or blog on how this is done! Could anyone point me in the right direction on finding out the easiest way to do this???

Thanks

+3  A: 

Use Newtonsofts Json.Net (http://james.newtonking.com/pages/json-net.aspx) and check out http://www.west-wind.com/Weblog/posts/471835.aspx where it's used to create a dataset->json converter.

finnsson
A: 

Maybe you've heard about the system.runtime.serialization.json namespace in the newly announced .Net Framework 4.0.

gimel
I have tried using the serialization.json namespace, but to no avail... There sont seem to be many examples on how to use it and the JavaScriptSerializer and the DataContractJsonSerializer are outputting XML