bdlou
Posts: 5
Joined: Sat May 02, 2015 3:14 pm
Location: Bothell, WA

Should Newtonsoft JSON.Net work?

Sat May 02, 2015 3:19 pm

I'm probably getting ahead of myself, but I wanted to throw together a simple app that pulls down a JSON source and displays the information from it. I brought in Newtonsoft JSON.Net but when I get to the DeserializeObject call it throws an exception:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization, Version=2.0.5.0

I assume that means the deployment process doesn't push over the binary dependency. So my question is, should it? Or is this type of thing even supported?

pwinwood
Posts: 74
Joined: Mon Jul 02, 2012 2:21 am
Location: Oxford, England

Re: Should Newtonsoft JSON.Net work?

Sat May 02, 2015 9:52 pm

The list of unavailable APIs is listed here

http://ms-iot.github.io/content/win10/U ... leApis.htm

However I cannot see System.Runtime.Serialization listed there.
How did you add a reference to Newtonsoft.Json?
Did you use the Package Manager Console in Visual Studio 2015 to add it from nuget to get a compatible version?

bdlou
Posts: 5
Joined: Sat May 02, 2015 3:14 pm
Location: Bothell, WA

Re: Should Newtonsoft JSON.Net work?

Sun May 03, 2015 12:10 pm

I did it through the UI. Manage NuGet Packages for Solution.

pauldy
Posts: 54
Joined: Tue Jun 12, 2012 3:34 pm

Re: Should Newtonsoft JSON.Net work?

Sun May 03, 2015 2:53 pm

It should work without issue you will just have to add ti as a dependency or if you want you can add it as an embedded resource and load it dynamically at application runtime.


But why not just use System.Web.Extensions? The System.Web.Script.Serialization.JavaScriptSerializer class is good enough for 90+% of what people do with Newtonsoft even though their charts make it look like no one does anything.

bdlou
Posts: 5
Joined: Sat May 02, 2015 3:14 pm
Location: Bothell, WA

Re: Should Newtonsoft JSON.Net work?

Sun May 03, 2015 3:26 pm

Great suggestions. I'll investigate all those options. Thanks!

bdlou
Posts: 5
Joined: Sat May 02, 2015 3:14 pm
Location: Bothell, WA

Re: Should Newtonsoft JSON.Net work?

Mon May 04, 2015 2:24 pm

Just to close the loop (sorta), this looks to actually be an issue with JSON.Net and UAP projects:
https://github.com/JamesNK/Newtonsoft.Json/issues/559

Return to “Windows 10 for IoT”