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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

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).
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").
Well ASP.NET Core is not released yet so don't expect any developer to release anything targeting .NET Core as "final". :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.