Hi
Below response is returned by API.
{"status":true,"message":"Shipment Cancelled"}
I want to display message Shippment Cancelled, else if status = false then error message
C#
IRestResponse response = client.Execute(request);Thanks
Hi
Below response is returned by API.
{"status":true,"message":"Shipment Cancelled"}
I want to display message Shippment Cancelled, else if status = false then error message
IRestResponse response = client.Execute(request);Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pasang TamangRank #449 · 5.6K reputationPosted Jan 12, 2023, 3:20 AM EST
Hi,
You can create a class for the response and deserialize object using Newtonsoft.Json. Please refer to below code.
IRestResponse response = client.Execute(request); var responseContent = JsonConvert.DeserializeObject(response.Content);public class Root { public bool status { get; set; } public string message { get; set; } }Regards,
Pasang