How can I use the JsonObject class?
20,370
Solution 1
Add using System.Json;
to the top of your file.
Edit
It seems that Windows Phone 7 doesn't support the System.Json
namespace so you cannot do it this way. After a cursory search, it seems you have to use the DataContractJsonSerializer
class as shown in this MSDN video/source code.
You may also want to consider using Json.NET which appears to be much more efficient than the DataContractJsonSerializer
.
Solution 2
I think this library is now deprecated in favour of Json.NET. JsonObject is now a JObject and requires Json.NET library.
Author by
Sheehan Alam
iOS, Android and Mac Developer. i can divide by zero.
Updated on July 09, 2022Comments
-
Sheehan Alam almost 2 years
I am building on Windows Phone 7. I noticed in the documentation I can:
JsonObject user = (JsonObject)JsonObject.Load(responseStream); bool isMember = user["IsMember"]; string name = user["Name"]; int age = user["Age"];
How can I import the JsonObject class?
-
Chris Rae over 13 yearsThis class does not exist on Windows Phone 7.
-
Richard Marskell - Drackir over 13 years@Chris R: I'm not sure how Sheehan got it to work then, but try this link for info.