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.
- 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
- .NET 6, 8, or 10
Install JsonMask.NET via NuGet:
dotnet add package JsonMask.NETvar original = "{ \"a\": 1, \"b\": 1 }";
var mask = "a";
var result = Masker.Mask(original, mask);
Console.WriteLine(result); // Output: "{ \"a\": 1 }"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 }"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.
Distributed under the MIT License. See LICENSE for more information.
- Inspired by json-mask by nemtsov