JsonUtils.setOrRemoveBoolean Function

Set or remove a boolean on a json object, given a key name, a value, and a default value. Sets json[key] = val if val is not equal to the default, otherwise delete json[key]. This is used to omit values from JSON strings that are of known defaults.

setOrRemoveBoolean(json: any, key: string, val: boolean, defaultVal: boolean): void

Parameter Type Description
json any the JSON object to affect
key string the name of the member to set or remove
val boolean the value to set
defaultVal boolean the default value.

Returns - void

Defined in

Last Updated: 30 November, 2023