Contact Me

Nirav Prabtani

Mobile : +91 738 308 2188

Email : niravjprabtani@gmail.com

Nirav Prabtani

Monday, 21 April 2014

How to Convert JSON String into Dataset using c#



We can easily convert json string into Dataset using c#
To use that ,you must have to doenload  Json.NET
Json.NET is a popular high-performance JSON framework for .NET
To install Json.NET, run the following command in the Package Manager Console


 DataSet dsRecognize = new DataSet();
                    string jsonStringRecognize = "Json String";
                    XmlDocument xdRecognize = new XmlDocument();
                    jsonStringRecognize = "{ \"rootNode\": {" + jsonStringRecognize.Trim().TrimStart('{').TrimEnd('}') + "} }";
                    xdRecognize = (XmlDocument)JsonConvert.DeserializeXmlNode(jsonStringRecognize);

                    dsRecognize.ReadXml(new XmlNodeReader(xdRecognize));


1 comment :