Dear Sir
I want to set Textbox of Json Response, but unable to set it.
Please help me out.
JSON Response :
{
"data": {
"client_id": "rc_rCgLRnzahMHDohSVjumj",
"rc_number": "RJ31GB1217",
"registration_date": "2021-04-01",
"owner_name": "YASIN MOHD.",
"father_name": "SAHAB ALI",
"present_address": "W.NO.06 PURABSAR RAWATSAR , RAWATSAR SPD GOV INBUILT,RAWATSAR, Hanumangarh -335524",
"permanent_address": "W.NO.06 PURABSAR RAWATSAR , RAWATSAR SPD GOV INBUILT,RAWATSAR, Hanumangarh -335524",
"mobile_number": null,
"vehicle_category": "HGV",
"vehicle_chasi_number": "MAT796002L5K07741",
"vehicle_engine_number": "02K63844969",
"maker_description": "TATA MOTORS LTD",
"maker_model": "TATA LPT 3518 BS-VI COWL",
"body_type": "TRUCK",
"fuel_type": "DIESEL",
"color": "ARCTIC WHITE",
"norms_type": "BHARAT STAGE VI",
"fit_up_to": "2023-03-31",
"financer": "INDUSIND BANK LTD",
"financed": true,
"insurance_company": "TATA AIG GENERAL INSURANCE CO. LTD.",
"insurance_policy_number": "0161756552",
"insurance_upto": "2022-01-29",
"manufacturing_date": "10/2020",
"registered_at": "HANUMANGARH DTO, Rajasthan",
"latest_by": "2021-06-15",
"less_info": false,
"tax_upto": "2022-03-31",
"cubic_capacity": "5635.0",
"vehicle_gross_weight": "35000",
"no_cylinders": "6",
"seat_capacity": "6",
"sleeper_capacity": "0",
"standing_capacity": "0",
"wheelbase": "5505",
"unladen_weight": "10000",
"vehicle_category_description": "Goods Carrier(HGV)",
"pucc_number": "NA",
"pucc_upto": "1900-01-01",
"permit_number": "RJ2021-GP-7613A",
"permit_issue_date": "2021-04-07",
"permit_valid_from": "2021-04-07",
"permit_valid_upto": "2026-04-06",
"permit_type": "Goods Permit[HEAVY GOODS VEHICLE]",
"national_permit_number": "",
"national_permit_upto": "1900-01-01",
"national_permit_issued_by": "",
"non_use_status": null,
"non_use_from": "1900-01-01",
"non_use_to": "1900-01-01",
"blacklist_status": "NA",
"noc_details": "NA",
"owner_number": "1",
"rc_status": "ACTIVE",
"masked_name": false,
"challan_details": null
},
"status_code": 200,
"success": true,
"message": null,
"message_code": "success"
}
C# Server Side
private void FleetApi(string RegisNumber )
{
VehicleRequest Pan = new VehicleRequest()
{
id_number = RegisNumber,
};
var client = new RestClient("http://192.168.1.231/rc");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept", "application/json");
string body = JsonConvert.SerializeObject(Pan);
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
string ms = response.Content;
var Data = JsonConvert.DeserializeObject<data>(ms);
txtEngineeNumber.Text = Data.vehicle_engine_number;
txtChasisNumber.Text = Data.vehicle_chasi_number;
}
private class VehicleRequest
{
public string id_number { get; set; }
}
public class data
{
public string client_id { get; set; }
public string rc_number { get; set; }
public string registration_date { get; set; }
public string vehicle_chasi_number { get; set; }
public string vehicle_engine_number { get; set; }
public string fit_up_to { get; set; }
public string tax_upto { get; set; }
public string permit_number { get; set; }
public string permit_issue_date { get; set; }
public string permit_valid_from { get; set; }
public string permit_valid_upto { get; set; }
}