/dictmask

Mask unnecessary data in your dicts

Primary LanguagePythonMIT LicenseMIT

dictmask - Simple library to mask fields in dict/json

Mask applied on top of your data. Everything that is not whitelisted - will be removed from dict. Works with nested dicts and lists.

Usage:

  1. Prepare your data

    data = {
        "a": "A",
        "b": "B"
    }
  2. Copy your data and prepare mask: True to keep field, False/None to remove

    mask = {
        "a": True,
        "b": False
    }
  3. Apply dictmask and check result

    dictmask(data, mask)
    {
        "a": "A"
    }