Users Pricing

forum

Home Forums Converting JSON to GridView – MindStick

Converting JSON to GridView

Anonymous User 8037 26 Dec 2014
 I set up a test DreamFactory server and I am trying to transform the results from JSON to a DataTable so I can display a GridView. I've tried several things with no success, this is my current code:

 var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                result = streamReader.ReadToEnd();
                dynamic d = JObject.Parse(result);
            }
            object obj = JsonConvert.DeserializeObject(result); 
            var table = JsonConvert.DeserializeObject<DataTable>(result); <--ERROR
            return table;
I've tried several methods but I am getting the following error most of the time:

Unexpected JSON token when reading DataTable. Expected StartArray, got StartObject. Path '', line 1, position 1.

It can deserialize fine as the object shows me the full deserialized JSON with no problems. Anything I can do?

EDIT: JSON Structure

{"record":[{"StatusID":1, "Identifier":"DQRJO1Q0IQRS",
 "Status":"WaitList",
"StatusDate":"2014-11-15",
"WorkedBy":"None",
"ContactedOn":"2014-11-15T14:21:55.623",
"Email":"email}]}

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md