Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'JToken' could not be found.
The JToken class is part of the Newtonsoft.Json namespace. To resolve this error, please add the following using directive at the top of your nameofyourview.cshtml file:
@using Newtonsoft.Json.Linq
Or if you are getting this error in your controller then just add this on top of your nameofyourcontroller.cs file:
using Newtonsoft.Json.Linq
This will ensure that the JToken class is recognized in your Razor view.
Please add the using directive and try running the code again.