Hello folks. Hope you all are well.
I am introducing something fancy here 🙂

Imagine you have a JSON object or array, and you need to create classes and the controller in web api for .net.
So now this is the fancy way we do it here, using our application to simplify to the life of coding.
Download the application from this link.

To generate:

  1. Start the application.
  2. Past your JSON object/array.
  3. Choose c# or vb.
  4. Generate and enjoy.

Output:

the output is folders/files for models, controller and a config file.

    1. models
    2. controllers
    3. config

You may need to some of the libraries, you can use the “Package manager console” in VS.

Install-Package Microsoft.AspNet.WebApi.WebHost
Update-Package Microsoft.AspNet.WebApi.WebHost -Pre
Install-Package Microsoft.AspNet.WebApi.Cors
Install-Package Newtonsoft.Json -Version 6.0.8

these plugins or dlls are required to the web Api 2 if you did create an empty project.
or you can create a web api2 project and add the classes generated.

Don’t forget to add this line to your Application_Start method in Global.asax file: WebApiConfig.Register(GlobalConfiguration.Configuration);

Source code available (github).