I am new to windows phone 8 development. I am working on application in which I need parse the Json. so I am not able to get the following data in windows phone 8.
var result= JObject.Parse(response)["response"]["ScoreDetail"];
foreach (var item in result)
{
// Code to store the result
}
I propose you to build classes of your json :
public class RootObject
{
public Response response { get; set; }
}
public class Response
{
public int errorFlag { get; set; }
[JsonProperty("Score Detail")]
public JObject ScoreDetail { get; set; }
}
You can use them on the DownloadStringCompleted event :
public void webClient1_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
RootObject root = JsonConvert.DeserializeObject<RootObject>(e.Result);
JObject obj = root.response.ScoreDetail;
foreach (KeyValuePair<string, JToken> pair in obj)
{
string key = pair.Key; // here you got 39.
foreach (JObject detail in pair.Value as JArray)
{
string date = detail["test_date"].ToString();
string score = detail["score"].ToString();
string total_marks = detail["total_marks"].ToString();
}
}
}
Hope it helps !