JSON Mask (JsonMaskGenerator)

The JSON Mask generator runs a selected generator on values that match a specified JSONPath.

For the JSON Mask generator, you provide a link object for each sub-generator configuration.

The generator does not itself support consistency or differential privacy.

The metadata object is populated from the JsonMaskMetadata object, and includes:

  • pathExpression, which is the JSONPath that identifies the value to apply the sub-generator to.

  • The types of values to apply the sub-generator to.

  • The subGeneratorMetadata object, which identifies and configures the sub-generator.

Here is the basic structure of a link object for a JSON Mask sub-generator.

{
  "schema": "string",
  "table": "string",
  "column": "string",
  "metadata": {
    "generatorId": "JsonMaskGenerator",
    "customValueProcessor": "string",  //If custom value processor applied  
    "pathExpression": "string",
    "jsonFilterTypes": [ enum ], 
    "subGeneratorMetadata": {
      "generatorId": "string",
      "presetId": "string",
      //Metadata for the selected sub-generator
      "customValueProcessor": "string"  //If custom value processor applied to the sub-generator
    }
  }
}

Example replacement

In the following example replacement for the JSON Mask generator:

  • The Date Truncation generator is applied to all values of the JSONPath expression $[*].start. The value is truncated to the year, and the birthdate flag is off.

  • The Email generator is applied to all values of the JSONPath expression $[0].email. The generated email addresses all use gmail.com as the domain, and no domains are excluded. Invalid email addresses are replaced. Consistency is disabled.

  • If there is an error applying those generators, then the fallback generator is the Null generator.

{
  "name": "json_data",
  "schema": "public"
  "table": "big_json",
  "links": [
    {
      "schema": "public",
      "table": "big_json",
      "column": "json_data",
      "metadata": {
        "generatorId": "JsonMaskGenerator",
        "presetId": "JsonMaskGenerator",
        "pathExpression": "$[*].start",
        "jsonFilterTypes": [
          0
        ],
        "subGeneratorMetadata": {
          "presetId": "DateTruncationGenerator",
          "generatorId": "DateTruncationGenerator",
          "datePart": "Year",
          "isBirthDate": false
        }
      }
    },
    {
      "schema": "public",
      "table": "big_json",
      "column": "json_data",
      "metadata": {
        "generatorId": "JsonMaskGenerator",
        "presetId": "JsonMaskGenerator",
        "pathExpression": "$[0].email",
        "jsonFilterTypes": [
          0
        ],
        "subGeneratorMetadata": {
          "presetId": "EmailGenerator",
          "generatorId": "EmailGenerator",
          "domain": "gmail.com",
          "excludedDomain": "",
          "replaceInvalidEmails": true,
          "isConsistent": false
        }
      }
    }
  ],
  "fallbackLinks": [
    {
      "schema": "public",
      "table": "big_json",
      "column": "json_data",
      "metadata": {
        "generatorId": "NullGenerator"
      }
    }
  ]
} 

Last updated