Madhu
Madhu

Reputation: 2551

How do I use JavaScriptSerializer in ASP.NET 5?

I am porting my project to DNX-Core 5.0 and trying to get work but I cannot find the JavaScriptSerializer and AppSettingReader classes. I know the System.Web is removed and so please anyone help me to find the alternative of using them.

Is there any Nuget available to include them?

Upvotes: 3

Views: 2307

Answers (1)

Matt DeKrey
Matt DeKrey

Reputation: 11942

The ASP.Net 5 team dropped the JavaScriptSerializer in favor of the widely used Newtonsoft.Json package, but they did provide a JsonOutputFormatter and a JsonInputFormatter for use with MVC to be able to return objects more directly.

For the AppSettingReader you'll want to look at the new ASP.Net 5 Configuration Model. This has been detailed in a few blog posts while it's being built. These posts only detail how to load out individual fields, but the tests in the Options Model show that you can bind directly to an object.

Upvotes: 7

Related Questions