JsonMask.NET
1.1.0
dotnet add package JsonMask.NET --version 1.1.0
NuGet\Install-Package JsonMask.NET -Version 1.1.0
<PackageReference Include="JsonMask.NET" Version="1.1.0" />
paket add JsonMask.NET --version 1.1.0
#r "nuget: JsonMask.NET, 1.1.0"
// Install JsonMask.NET as a Cake Addin
#addin nuget:?package=JsonMask.NET&version=1.1.0
// Install JsonMask.NET as a Cake Tool
#tool nuget:?package=JsonMask.NET&version=1.1.0
JsonMask.NET
JsonMask.NET is a simple .NET port of the popular JavaScript library json-mask, designed to allow selective filtering of JSON data using a concise syntax. This library is perfect for reducing payloads in APIs, extracting specific parts from JSON, and more, with compatibility across all .NET applications.
Features
- Lightweight and easy to integrate
- Supports the same syntax as the original json-mask library
- Available as a static utility or as a service for dependency injection
Getting Started
Prerequisites
- .NET 6 or higher
Installation
Install JsonMask.NET via NuGet:
dotnet add package JsonMask.NET
Usage
Static Usage
var original = "{ \"a\": 1, \"b\": 1 }";
var mask = "a";
var result = Masker.Mask(original, mask);
Console.WriteLine(result); // Output: "{ \"a\": 1 }"
Using MaskerService
IMaskerService maskerService = new MaskerService();
var original = "{ \"a\": 1, \"b\": 1 }";
var mask = "a";
var result = maskerService.Mask(original, mask);
Console.WriteLine(result); // Output: "{ \"a\": 1 }"
Contributing
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. Please refer to the CONTRIBUTING.md file for detailed contribution guidelines.
License
Distributed under the MIT License. See LICENSE for more information.
Acknowledgments
- 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
- Newtonsoft.Json (>= 13.0.3)
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on JsonMask.NET:
Package | Downloads |
---|---|
JsonMask.NET.AspNetCore.Mvc.Controller.Filter
Mvc Controller filter to retrieve only requested json elements of a given resource. It uses JsonMask.NET. |
GitHub repositories
This package is not used by any popular GitHub repositories.