0

Im getting json data through webservice..and i want put data from lstResponsewrap into table or Repeater in c#..how to do this ..

    {
    "Success": true,
    "Status": "Success",
    "serviceLogs": [],
    "PaymentTerms": [
        {
            "strUnitName": "TS MSQ JN1-12-1201",
            "propertyInventoryId": "a0KP0000001fwB3MAI",
            "lstResponsewrap": [
                {
                    "TERMDAYS": "0",
                    "TERMDATE": "2017-11-29",
                },
                {
                    "TERMDAYS": "1",
                    "TERMDATE": "2017-10-3",
                }],
              }]}

c# Code

        using (var response = httpReq.GetResponse())
        {
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string dr = reader.ReadToEnd();

             var myRoot = JsonConvert.DeserializeObject<RootObject>(dr);
            var roote = myRoot.PaymentTerms;

        }
priya
  • 1
  • 2
  • Welcome to StackOverflow, I think you should clarify your question a bit with examples of what you have tried so far, and what output you are expecting. See [how to ask a question.](http://stackoverflow.com/help/how-to-ask) – Roman Marusyk Nov 29 '17 at 09:41
  • 1
    Could you add more information; where is this JSON data, is it in a plain text file, in an object, in a string. What table are you trying to get it to MS SQL, Oracle, MySQL etc. What have you tried so far? – d219 Nov 29 '17 at 09:45
  • Also have a look at this https://stackoverflow.com/help/how-to-ask if you provide some more information someone will be able to help but as it stands we don't know enough about what you're trying to do and what problems you've seen. Cheers! – d219 Nov 29 '17 at 09:47
  • There are a number of options for processing JSON. [JSON.Net](https://www.nuget.org/packages/Newtonsoft.Json/10.0.3) is generally the preferred one. – Richard Nov 29 '17 at 09:49
  • OK so presumably roote.lstResponsewrap exists does it? When you say 'table' is it a database table you are talking about? Does the code you are working with have any existing way of writing to tables, or is the whole concept of writing to a table new here? – d219 Nov 29 '17 at 10:10
  • Possible duplicate of [Parse JSON in C#](https://stackoverflow.com/questions/1212344/parse-json-in-c-sharp) – Magnetron Nov 29 '17 at 10:18
  • We have no info on the table or the repeater in "lstResponsewrap into table or Repeater". And you can have more than 1 lstResponsewrap . – H H Nov 29 '17 at 10:56

0 Answers0