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);
Similar Posts:
- Causes and solutions of self referencing loop detected with type
- [Solved] Json.Net – Error getting value from ‘ScopeId’ on ‘System.Net.IPAddress’
- [Solved] Json.Net Error: Error getting value from ‘ScopeId’ on ‘System.Net.IPAddress’
- Processing method of JSON error ‘XXX is not JSON serializable’
- Failed to deserialize — local class incompatible: stream classdesc serialVersionUID [Solved]
- fastjson java.lang.StackOverflowError [How to Solve]
- Uncaught Error: Bootstrap’s JavaScript requires jQuery at bootstrap.min.js:6
- [Solved] Jquery each error: Uncaught TypeError: Cannot use ‘in’ operator to search for
- [Solved] No serializer found for class XXX and no properties discovered to create BeanSerializer
- [Solved] Caused by: com.esotericsoftware.kryo.KryoException: Buffer overflow. Available: 0, required: 134217728