Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parse/deserialize a JSON string in C# XAML Windows 8 Metro App?

I am developing a C#/XAML metro application in which I comsume a JSON REST Services. How can I deserialize a JSON response into a text or a custom object?

like image 731
user1516781 Avatar asked Dec 02 '25 21:12

user1516781


1 Answers

The official JSON APIs for Windows Store Apps are in the Windows.Data.Json namespace:

  • JsonObject.Parse() or new JsonOject() for objects, it works more less like a Dictionary<TKey, TValue>.
  • JsonArray.Parse() or new JsonArray() for arrays, it work more less like a List<TValue>.
  • JsonValue.Parse(), JsonValue.CreateStringValue(), JsonValue.CreateBooleanValue() or JsonValue.CreateNumberValue() for string, boolean, number and null values.

Check some samples here: http://msdn.microsoft.com/en-us/library/windows/apps/hh770289.aspx

You won't need to add any library.

like image 76
kiewic Avatar answered Dec 05 '25 11:12

kiewic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!