exclude_field_by_value
No overview available.
def exclude_field_by_value(
data: dict,
field_name: string,
value_to_exclude: any
) - > dict
Removes a specific field from a dictionary if its value matches a target value, typically used to prune default or null values before serialization.
Parameters
| Name | Type | Description |
|---|---|---|
| data | dict | The source dictionary containing the fields to be evaluated for exclusion. |
| field_name | string | The key within the dictionary to check for the exclusion criteria. |
| value_to_exclude | any | The specific value that triggers the removal of the field if a match is found. |
Returns
| Type | Description |
|---|---|
dict | A copy of the input dictionary with the specified field removed if the value condition was met; otherwise, the original dictionary structure. |