Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

consume json using

hi experts, I just want to learn how to bind json string to repeater & datatable.
Please show me how. I am not an expert of framework.


Return json string:
{"FleetID":6045,"Make":"Kenworth","Model":"T800","FleetMasterType":"Tow","FleetClassType":"Tow Truck","FleetClassSubType":"Heavy Duty Wrecker"},
{"FleetID":6046,"Make":"Freightliner","Model":"Business Class M2 106","FleetMasterType":"Tow","FleetClassType":"Tow Truck","FleetClassSubType":"Medium Duty Trucks Roll-back"}

public string GetFleetList(string FleetMasterType, string responseType)
            string RegIDvalue = "0";
            using (System.Net.WebClient client = new System.Net.WebClient())
                var reqparm = new System.Collections.Specialized.NameValueCollection();
                reqparm.Add("FleetMasterType", FleetMasterType);
                byte[] responsebytes = client.UploadValues(domain + "/api/Fleet/GetFleetList?type="+ responseType, "POST", reqparm);
                string responsebody = Encoding.UTF8.GetString(responsebytes);
                if (responseType == "xml")
                    RegIDvalue = GetResponseValue(responsebody, "Fleet", "FleetClassType");
                    RegIDvalue = responsebody;
            return RegIDvalue;

Open in new window

Avatar of ITsolutionWizard
Flag of United States of America image


any helps?
Avatar of David H.H.Lee
David H.H.Lee
Flag of Malaysia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just need to know how to bind Json with repeater. 
not calling api because I already done that. Just need a way to treat incoming json to asp repeater.
any helps
protected void Page_Load(object sender, EventArgs e)
    string json ="your returned JSON string...";
    Rootobject _objRoot = JsonConvert.DeserializeObject<Rootobject>(json);
    Repeater1.DataSource = _objRoot.root;

Open in new window

Share more information for your working snippet code if you need further assistance.

what is Rootobject ?