0

This is the json string that I want to parse. Im using the default Json functions available in Windows 8

JSON value:

"{\"updated_at\":1405482225,\"settings\":{\"conception_mode\":1,\"app_lock_string\":\"\",\"user_cycle_length\":21,\"week_starts_monday\":1}}"

My sample code:

 JsonObject test1 = JsonObject.Parse(received);
 var timestamp = test1.GetNamedValue("updated_at").GetNumber();
 settingsTimestamp = (long)(Convert.ToDouble(timestamp));

 string settingString = test1.GetNamedValue("settings").GetString();//ERROR
 JsonObject settingsVal = JsonObject.Parse(settingString);

I get the "updated_at" value but when I try to retrieve "settings", it is throwing exception saying, it is not a string.

For windows phone, I have done using JSON.NET library, so things were a little easier. How do I parse this in Windows8

1 Answer 1

2

settings is a JSON object. So you can use GetObject directly:

JsonObject settingsVal = test1.GetNamedValue( "settings" ).GetObject();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.