Skip to content

sidec15/JsonMask.NET

Repository files navigation

JsonMask.NET

Build Status codecov

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, 8, or 10

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

About

DotNet porting of the NodeJS library json-mask

Resources

License

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors