using System;
using System.Data;
using System.Windows.Forms;
using Newtonsoft.Json;
using System.Xml;
private void temp2()
{
string pjson = System.IO.File.ReadAllText(@"c:\temp\json.txt");
DataSet dsRecognize = new DataSet();
XmlDocument xdRecognize = new XmlDocument();
xdRecognize = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"Row\":" + pjson + "}", "root");
dsRecognize.ReadXml(new XmlNodeReader(xdRecognize));
dataGridView1.DataSource = dsRecognize.Tables[0];
}
**************************
Some notes:
c:\temp\json.txt is a copy of a json response. Remove the initial "while(1);" but keep the brackets "[]"
No comments:
Post a Comment