Skip to content
Simplify.Web.Json is a package which provides JSON serialization/deserialization for Simplify.Web web-framework controllers.
C#
Branch: master
Clone or download
Pull request Compare This branch is 38 commits ahead, 1 commit behind i4004:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
.vscode
IntegrationTests
src
.gitattributes
.gitignore
LICENSE
README.md
appveyor.yml

README.md

Simplify.Web.Json

Nuget Version Nuget Download AppVeyor branch Libraries.io dependency status for latest release CodeFactor Grade Platform Dependabot Status PRs Welcome

Simplify.Web.Json is a package which provides JSON serialization/deserialization for Simplify.Web web-framework controllers.

Quick Start

Sending JSON to client

If the controller returns Json response class object, then the Framework execution will be stopped, object will be parsed to JSON string and sent to client

public class MyController : Controller
{
    public override ControllerResponse Invoke()
    {
        ...
        return new Json(myObj);
    }
}

Getting JSON from client

Registering binder

public void Configuration(IApplicationBuilder app)
{
    ...
    HttpModelHandler.RegisterModelBinder<JsonModelBinder>();

    app.UseSimplifyWeb();
}

public void ConfigureServices(IServiceCollection services)
{
    ...
    DIContainer.Current.RegisterJsonModelBinder();
    ...
}

Accessing model

JSON string will be deserialized to the controller model on first model access

public class MyController : Controller<MyModel>
{
    public override ControllerResponse Invoke()
    {
        Model.
    }
}
You can’t perform that action at this time.