# Custom Categorical (CustomCategoricalGenerator)

The [Custom Categorical](https://docs.tonic.ai/app/generation/generators/generator-reference/custom-categorical) generator is a version of the Categorical generator that selects from values that you provide instead of shuffling the original values.

## Link object structure <a href="#generator-api-custom-categorical-link-object" id="generator-api-custom-categorical-link-object"></a>

The Custom Categorical generator supports linking. It can be made self-consistent or consistent with another column. You cannot configure differential privacy.

The `metadata` object is populated from the [`CustomCategoricalMetadata`](https://app.tonic.ai/apidocs/index.html#/models/CustomCategoricalMetadata) object. You use the `customCategories` field to provide a list of the values to use for the column in the destination database. The values are provided on a single line, separated with newline characters (`\n`). For example, `"Small\nMedium\nLarge"`. To include NULL as an available value, use `{NULL}`.

```json
{
  "schema": "string",
  "table": "string",
  "column": "string",
  "path": "string",  //JSON fields only
  "dataType": "string",  //MongoDB, Amazon DynamoDB, and JSON fields only
  "metadata": {
    "presetId": "string",
    "generatorId": "CustomCategoricalGenerator",
    "customCategories": "value\nvalue",
    "isConsistent": boolean,
    "consistencyColumn": "string",
    "encryptionProcessor": "x-on", //To use configured Structural data encryption
    "customValueProcessor": "string" //If custom value processor applied
  }
}
```

## Example replacement <a href="#generator-api-custom-categorical-replacement" id="generator-api-custom-categorical-replacement"></a>

In this example replacement for the Custom Categorical generator, the values to use are Red, Yellow, Blue, and White. The generator is not linked.

Consistency is disabled.

```json
{
  "name": "color",
  "schema": "public",
  "table": "products",
  "links": [
    {
      "schema": "public",
      "table": "products",
      "column": "color",
      "metadata": {
        "presetID": "CustomCategoricalGenerator",
        "generatorId": "CustomCategoricalGenerator",
        "customCategories": "Red\nYellow\nBlue\nWhite",
        "isConsistent": false
      }
  ]
}
```
