Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to work with ASP.NET Core 2.0 and newtonsoft.json

I am doing the first of my asp.net projects, and we have settled on using asp.net core v. 2.0 - now that ms has released it. - we are using .NET 4.6 in our backed projects. but I am having some problems with using Newtonsoft.json, that apparently doesn't support the .netstandard 2.0 in the version 10.0.1 that I've installed. And for some unknown reason it will not install v.10.0.3, - I get this:

    Error   NU1202  Package Newtonsoft.Json 10.0.1 is not compatible with net461 (.NETFramework,Version=v4.6.1) / win7-x64. Package Newtonsoft.Json 10.0.1 supports:
  - net20 (.NETFramework,Version=v2.0)
  - net35 (.NETFramework,Version=v3.5)
  - net40 (.NETFramework,Version=v4.0)
  - net45 (.NETFramework,Version=v4.5)
  - netstandard1.0 (.NETStandard,Version=v1.0)
  - netstandard1.3 (.NETStandard,Version=v1.3)
  - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)    ScannerWebRemoteControl

any ideas anyone?

like image 415
kfn Avatar asked Sep 13 '17 08:09

kfn


People also ask

Is Newtonsoft JSON compatible with .NET Core?

Json library is included in the runtime for . NET Core 3.1 and later versions. For other target frameworks, install the System.

Is JSON net the same as Newtonsoft JSON?

Json.net is made by newtonsoft.

How does Newtonsoft JSON work?

Newtonsoft. Json uses reflection to get constructor parameters and then tries to find closest match by name of these constructor parameters to object's properties. It also checks type of property and parameters to match. If there is no match found, then default value will be passed to this parameterized constructor.


1 Answers

Open Integrated Terminal and run code given below

dotnet add package Newtonsoft.Json

It will download and add Newtonsoft.Json to the project (Latest version).

like image 184
Dee Nix Avatar answered Nov 14 '22 22:11

Dee Nix