# Default Values Override Null Number Input

**URL:** <https://jsonforms.discourse.group/t/default-values-override-null-number-input/2219>\
**Category:** General\
**Created:** [July 7, 2024, 11:59pm UTC](https://jsonforms.discourse.group/t/default-values-override-null-number-input/2219 "2024-07-07T23:59:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![avwchapman](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@avwchapman](https://jsonforms.discourse.group/u/avwchapman)\
**Post date:** [July 7, 2024, 11:59pm UTC](https://jsonforms.discourse.group/t/default-values-override-null-number-input/2219/1 "2024-07-07T23:59:16Z")

</div>

I cannot clear the number input. Once I clear the number input, if I refresh the page, the default value overrides the null one.

---

<div class="post-metadata">

**Author:** ![lucas-koehler](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/lucas-koehler/32/336_2.png) [@lucas-koehler](https://jsonforms.discourse.group/u/lucas-koehler)\
**Post date:** [July 8, 2024, 4:37pm UTC](https://jsonforms.discourse.group/t/default-values-override-null-number-input/2219/2 "2024-07-08T16:37:04Z")

</div>

Hi @avwchapman ,

We use AJV to set the default values. As `null` is not a valid number, it is overridden with the default value. If you mean that you remove the number in the renderer, it is reset to `undefined`. It is the expected behavior that `undefined` is changed to the default value by AJV on load.

To allow `null` values for a number, you probably need to adapt the property’s type in the JSON Schema to something like: `"type": ["string", "null"]`.  
Doing that, you’ll need to re-register the renderer and possibly adapt it to handle `null` values.

An easier solution might be to remove the default value from your schema and inititialize the data object with this yourself.
