TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mukesh
NA
228
43.1k
How to Convert JSON to DataTable in C#
Nov 30 2018 11:00 AM
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("http://xml.flightview.com/fvDemoConsOOOI/fvxml.exe?a=fvxmldemoSoo1&b=thrk$xxxx&depap=xxx&depdate=xxxxxx&dephr=xxxx");
httpWebRequest.Method = WebRequestMethods.Http.Get;
httpWebRequest.Accept = "application/json; charset=utf-8";
string file;
var response = (HttpWebResponse)httpWebRequest.GetResponse();
using (var sr = new StreamReader(response.GetResponseStream()))
{
file = sr.ReadToEnd();
}
//var json = JObject.Parse(file);
var table = JsonConvert.DeserializeAnonymousType(file, new { Makes = default(DataTable) }).Makes;
if (table.Rows.Count > 0)
{
//do something
}
I am trying to do this code but i am getting exception -
An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.dll but was not handled in user code
Additional information: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
so kindely please help me urgent
Reply
Answers (
4
)
php or .net for startup
How to remove DOM element using Jquery