charitht99 perera
charitht99 perera

Reputation: 325

Get Data inside Json using a key

I 'm working on a Xamarin Forms application, I m using a rest service to get data from the server. I want to get a value inside the JSON. Response.content 's JSON is below.

{"Success":true,"ErrorMessages":[],"Data":{"text":"Yes","value":100}}

Upvotes: 1

Views: 67

Answers (1)

Pranay Rana
Pranay Rana

Reputation: 176916

you need to Deserialize your json data by using library like NewtonSoft.JSON/Json.NET , example

using Newtonsoft.Json.Linq;
void Example ()
{
    string json = @"{ Name: 'Bob', HairColor: 'Brown' }";
    var bob = JObject.Parse (json);
    Console.WriteLine ("{0} with {1} hair", bob["Name"], bob["HairColor"]);
}

Upvotes: 4

Related Questions