2

I am porting a .Net framework built MVC application to .Net Core 3.1 and I have a case where System.Web.Helpers.Json.Encode() methods have been used.

As System.Web.Helpers is not available in .Net Core, any idea what alternate to use?

Adrian Mole
  • 43,040
  • 110
  • 45
  • 72
Sachin
  • 369
  • 3
  • 14

1 Answers1

3

You can use the built-in json serializer (System.Text.Json)

var obj = getMyObject();
var json = JsonSerializer.Serialize(obj);

https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to?pivots=dotnet-core-3-1

taylorj94
  • 61
  • 3