JsonMask.NET.AspNetCore.Mvc.Controller.Filter
1.0.0
dotnet add package JsonMask.NET.AspNetCore.Mvc.Controller.Filter --version 1.0.0
NuGet\Install-Package JsonMask.NET.AspNetCore.Mvc.Controller.Filter -Version 1.0.0
<PackageReference Include="JsonMask.NET.AspNetCore.Mvc.Controller.Filter" Version="1.0.0" />
paket add JsonMask.NET.AspNetCore.Mvc.Controller.Filter --version 1.0.0
#r "nuget: JsonMask.NET.AspNetCore.Mvc.Controller.Filter, 1.0.0"
// Install JsonMask.NET.AspNetCore.Mvc.Controller.Filter as a Cake Addin #addin nuget:?package=JsonMask.NET.AspNetCore.Mvc.Controller.Filter&version=1.0.0 // Install JsonMask.NET.AspNetCore.Mvc.Controller.Filter as a Cake Tool #tool nuget:?package=JsonMask.NET.AspNetCore.Mvc.Controller.Filter&version=1.0.0
JsonMask.NET.AspNetCore.Mvc.Controller.Filter
This ASP.NET Core MVC filter empowers developers to selectively retrieve specific JSON elements from a resource's response. Built on the robust capabilities of JsonMask.NET, this library offers a streamlined and efficient approach to manipulating JSON responses. By leveraging query parameters, developers can easily tailor the JSON output, ensuring that clients receive only the data they need. This not only enhances the flexibility of API responses but also optimizes data transfer and processing, making it an ideal solution for scenarios where bandwidth and processing efficiency are crucial.
Features
- Filter JSON responses in ASP.NET Core MVC applications.
- Specify elements of a JSON response to include using simple query parameters.
- Easy integration with existing ASP.NET Core MVC applications.
Getting Started
Prerequisites
- .NET 6 or higher
- Familiarity with MVC pattern in ASP.NET Core
Installation
Install JsonMask.NET.AspNetCore.Mvc.Controller.Filter
via NuGet:
Install-Package JsonMask.NET.AspNetCore.Mvc.Controller.Filter -Version [Version]
Replace [Version]
with the desired version number.
Setup
1. Add JsonMask Service and Filter
In your Startup.cs
, register the necessary services and filters:
public void ConfigureServices(IServiceCollection services)
{
// ...
services.AddJsonMask();
// ...
}
2. Add Swagger Support
If you are using Swagger, add the JsonMaskedSwaggerFilter
to your Swagger configuration:
public void ConfigureServices(IServiceCollection services)
{
// ...
services.AddSwaggerGen(options =>
{
options.OperationFilter<JsonMaskedSwaggerFilter>();
});
// ...
}
Usage
Apply the JsonMasked
attribute at the action level:
[JsonMasked]
public IActionResult MyAction()
{
// Your action logic here
}
Documentation
For more detailed information on usage and syntax, please refer to the JsonMask.NET documentation.
Contributing
Contributions to JsonMask.NET.AspNetCore.Mvc.Controller.Filter
are welcome. Please read our contributing guidelines for details on submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
- Based on JsonMask.NET.
- Inspired by json-mask by nemtsov
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- JsonMask.NET (>= 1.1.0)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.5.0)
-
net7.0
- JsonMask.NET (>= 1.1.0)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.5.0)
-
net8.0
- JsonMask.NET (>= 1.1.0)
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
- Swashbuckle.AspNetCore.SwaggerGen (>= 6.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 976 | 1/28/2024 |