JsonUtils.setOrRemoveNumber Function

Set or remove a number 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.

setOrRemoveNumber(json: any, key: string, val: number, defaultVal: number): void

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

Returns - void

Defined in

Last Updated: 15 June, 2021