Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simplifynet/simplify.web.json
Simplify.Web.Json is a package which provides JSON serialization/deserialization for Simplify.Web web-framework controllers.
https://github.com/simplifynet/simplify.web.json
dot-net dot-net-core json simplify simplify-web
Last synced: about 2 months ago
JSON representation
Simplify.Web.Json is a package which provides JSON serialization/deserialization for Simplify.Web web-framework controllers.
- Host: GitHub
- URL: https://github.com/simplifynet/simplify.web.json
- Owner: SimplifyNet
- License: lgpl-3.0
- Created: 2019-09-15T04:59:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-09T00:50:30.000Z (12 months ago)
- Last Synced: 2024-04-26T19:20:15.885Z (8 months ago)
- Topics: dot-net, dot-net-core, json, simplify, simplify-web
- Language: C#
- Homepage:
- Size: 3.97 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simplify.Web.Json
[![Nuget Version](https://img.shields.io/nuget/v/Simplify.Web.Json)](https://www.nuget.org/packages/Simplify.Web.Json/)
[![Nuget Download](https://img.shields.io/nuget/dt/Simplify.Web.Json)](https://www.nuget.org/packages/Simplify.Web.Json/)
[![Build Package](https://github.com/SimplifyNet/Simplify.Web.Json/actions/workflows/build.yml/badge.svg)](https://github.com/SimplifyNet/Simplify.Web.Json/actions/workflows/build.yml)[![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/nuget/Simplify.Web.Json)](https://libraries.io/nuget/Simplify.Web.Json)
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/SimplifyNet/Simplify.Web.Json)](https://www.codefactor.io/repository/github/simplifynet/simplify.web.Json)
![Platform](https://img.shields.io/badge/platform-.NET%206.0%20%7C%20.NET%20Standard%202.1%20%7C%20.NET%20Standard%202.0-lightgrey)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)](http://makeapullrequest.com)[Simplify.Web.Json](https://www.nuget.org/packages/Simplify.Web.Json/) is a package which provides JSON serialization/deserialization for [Simplify.Web](https://github.com/SimplifyNet/Simplify.Web) web-framework controllers using `Newtonsoft.Json`.
## 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
```csharp
public class MyController : Controller2
{
public ControllerResponse Invoke()
{
...
return new Json(myObj);
}
}
```### Getting JSON from client
#### Registering binder
```csharp
public void Configuration(IApplicationBuilder app)
{
...
HttpModelHandler.RegisterModelBinder();app.UseSimplifyWeb();
}public void ConfigureServices(IServiceCollection services)
{
...
HttpModelHandler.ModelBindersTypes.Clear(); // This is required to remove built-in JSON model binder (based on System.Text.Json)
DIContainer.Current.RegisterJsonModelBinder();
...
}
```#### Accessing model
##### Asynchronous
```csharp
public class MyController : Controller2
{
public async Task Invoke()
{
await ReadModelAsync();Model.
}
}
```##### Synchronous
JSON string will be deserialized to the controller model on first model access
```csharp
public class MyController : Controller2
{
public ControllerResponse Invoke()
{
Model.
}
}
```## Contributing
There are many ways in which you can participate in the project. Like most open-source software projects, contributing code is just one of many outlets where you can help improve. Some of the things that you could help out with are:
- Documentation (both code and features)
- Bug reports
- Bug fixes
- Feature requests
- Feature implementations
- Test coverage
- Code quality
- Sample applications## Related Projects
Additional extensions to Simplify.Web live in their own repositories on GitHub. For example:
- [Simplify.Web.Postman](https://github.com/SimplifyNet/Simplify.Web.Postman) - Postman collection and environment generation
- [Simplify.Web.Swagger](https://github.com/SimplifyNet/Simplify.Web.Swagger) - Swagger generation for controllers
- [Simplify.Web.Multipart](https://github.com/SimplifyNet/Simplify.Web.Multipart) - multipart form model binder
- [Simplify.Web.MessageBox](https://github.com/SimplifyNet/Simplify.Web.MessageBox) - non-interactive server side message box
- [Simplify.Web.Templates](https://github.com/SimplifyNet/Simplify.Web.Templates) - .NET projects templates## License
Licensed under the GNU LESSER GENERAL PUBLIC LICENSE