# Default Value not displaying

**URL:** <https://jsonforms.discourse.group/t/default-value-not-displaying/1097>\
**Category:** General\
**Created:** [October 25, 2022, 3:29am UTC](https://jsonforms.discourse.group/t/default-value-not-displaying/1097 "2022-10-25T03:29:14Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [October 26, 2022, 10:01am UTC](https://jsonforms.discourse.group/t/default-value-not-displaying/1097/2 "2022-10-26T10:01:23Z")

</div>

Hi @Dhruw,

Thanks for the kind words.

The “problem” with the `default` keyword in JSON Schema is that there is no associated semantic meaning to it, so any framework/library is free to handle it how they see it fit, e.g. when and how to set the value.

In JSON Forms itself we don’t have any special functionality implemented regarding the `default` properties. However internally we use AJV which offers some (limited) default functionality, i.e. it will set `default` values during the validation process in case they are undefined. See [here](https://jsonforms.discourse.group/t/help-with-default-values/31/2) for how to enable this functionality in JSON Forms.  
Having said that, I think defaults within a `oneOf` construct like you defined are exactly one of the use cases which is not supported by AJV. The reason is because it is impossible for AJV to know which `oneOf` actually applies to your data.

However there is a way to accomplish your goal: You can implement a custom `oneOf` renderer in JSON Forms and then on tab change (or however the renderer visualizes the `oneOf` selection) you can just set the `default` value in the object.

Unrelated to the question at hand: Your JSON Schema is rather unconvential, in the sense of that all `oneOf` entries are exactly the same and just differ in the `default` value. Was this done to illustrate the problem or is that an actual schema you’re using? If it’s the latter then I would like to suggest to replace the whole `oneOf` with a simple `enum` containing three options.

---

_[View the full topic](https://jsonforms.discourse.group/t/default-value-not-displaying/1097)._
