3

I am creating a cross-platform library using the .NET core class library project template and need to communicate with a REST service using JSON.

I can't use the JSON.NET Nuget package or "System.Runtime.Serialization.Json" because neither of these packages support .netcore.

For legacy reasons as well as netstandard1.2 I am also targeting net40.

Athari
  • 33,702
  • 16
  • 105
  • 146
Lee Sanderson
  • 43
  • 1
  • 6

1 Answers1

2

You can use Newtonsoft.Json.

Alternatively, you could write metadata for it in the Swagger format and use AutoRest to automatically generate a proxy class for you. Internally the generated code from AutoRest uses Newtonsoft.Json for json serialization.

Ivan Prodanov
  • 34,634
  • 78
  • 176
  • 248
  • I have already tried using Newtonsoft.Json. As I said in the original post this doesn't support .netstandard1.5 - I get the following error: Package Newtonsoft.Json 8.0.3 is not compatible with netstandard1.5 (.NETStandard,Version=v1.5). – Lee Sanderson Jun 14 '16 at 15:05
  • Ivan you are right. I can use Newtonsoft.Json but I have to use the beta version of the Nuget package (actually version "9.0.1-beta1"). – Lee Sanderson Jun 14 '16 at 15:11
  • Well ASP.NET Core is not released yet so don't expect any developer to release anything targeting .NET Core as "final". :) – Ivan Prodanov Jun 14 '16 at 15:16