Tag Archives: C# .net core

C #. Net core: How to use Jsonconvert replace JavaScriptSerializer

There are no system. Runtime. Serialization. JSON and system. Web. Script. Serialization in. Net core, so there is no JavaScript serializer. Therefore, jsonconvert in newtonsoft. JSON can be used to replace jsonconvert when porting projects

Code:

//.net framework
//JavaScriptSerializer serializer = new JavaScriptSerializer();
//var res = serializer.Serialize(YourObject);

//.net core Newtonsoft.Json
var res = JsonConvert.SerializeObject(YourObject);