Effortless getting data out of a JSON REST response
One of the pains with using REST is getting the data from JSON into something usable. There is a very simple solution: Take the JSON, pass it to a magic black box and get a dataset back that has foreign keys and other joys. That sounds very nice -- Make the JSON REST call and then Query or filter data tables to do future processing. No need to define classes to deserialize the JSON into..... The code is horrible and shown below... using System; using System.Linq; using System.Data; using System.Xml; using Newtonsoft.Json; namespace Avalara.AvaTax.JsonUtilities { public static class Utility { public static DataSet ConvertJsonToDataSet(string jsonText, string rootElementName) { var xd1 = new XmlDocument(); xd1 =JsonConvert.DeserializeXmlNode( jsonText,rootElementName); var result = new DataSet(); result.ReadXml(new XmlNodeReader(xd1)); return result; } } } To put this...