user3456546
user3456546

Reputation: 109

How to read form-url encoded response

I am making HTTP Post request to Rest service

Content: application/x-www-form-urlencoded Accept: application/x-www-form-urlencoded

I get response in below format

"{\r\n\t\"status\":\"Success\"\r\n}"

Is there any good way to load this string and read status

Upvotes: 0

Views: 495

Answers (1)

Bill
Bill

Reputation: 1479

Check out the Json.Net library: http://james.newtonking.com/json (Nuget: Newtonsoft.Json)

You could digest the response into a dynamic class:

var testData = "{\r\n\t\"status\":\"Success\"\r\n}";
dynamic testObject = JsonConvert.DeserializeObject(testData);
Console.WriteLine(testObject.status); //Success
Console.ReadKey();

Upvotes: 1

Related Questions