# Custom error messages

**URL:** <https://jsonforms.discourse.group/t/custom-error-messages/140>\
**Category:** General\
**Created:** [April 22, 2021, 8:17am UTC](https://jsonforms.discourse.group/t/custom-error-messages/140 "2021-04-22T08:17:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![discobot](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/discobot/32/3_2.png) [@discobot](https://jsonforms.discourse.group/u/discobot)\
**Post date:** [April 22, 2021, 8:17am UTC](https://jsonforms.discourse.group/t/custom-error-messages/140/1 "2021-04-22T08:17:19Z")

</div>

Hi,

we have integrated jsonforms with react app, can you please share the examples how to integrated ajv for custom error messages.

thanks

_[[original thread](https://spectrum.chat/jsonforms/general/custom-error-messages~4e124b4e-e5ff-48a2-9ab6-2fd019733371) by kirannaikRNR]_

---

<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:** [April 22, 2021, 8:57am UTC](https://jsonforms.discourse.group/t/custom-error-messages/140/2 "2021-04-22T08:57:21Z")

</div>

Hi. You can use [ajv-errors](https://github.com/ajv-validator/ajv-errors) for that. Note that we currently use Ajv v6, therefore you also need to use ajv-errors v1. You can use the `createAjv` function exported from `@jsonforms/core` to create your Ajv instance, customize it with `ajv-errors` and then pass it as a prop to `JsonForms`.

---

<div class="post-metadata">

**Author:** ![discobot](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/discobot/32/3_2.png) [@discobot](https://jsonforms.discourse.group/u/discobot)\
**Post date:** [April 22, 2021, 10:05am UTC](https://jsonforms.discourse.group/t/custom-error-messages/140/3 "2021-04-22T10:05:45Z")

</div>

_[kirannaikRNR]_

thanks for the quick response  
I have installed ajv-errors v1

first I have a added a property called errorMessage in my schema  
ie: errorMessage : “test message”  
and then const ajv = createAjv();  
const validate = ajv.compile(schema);  
and finally passing ajv obj as props to jsonforms

im still seeing the default messages

are my steps are correct please help me.  
thanks

---

<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:** [February 10, 2022, 12:28pm UTC](https://jsonforms.discourse.group/t/custom-error-messages/140/4 "2022-02-10T12:28:08Z")

</div>

Update: We [updated to AJV v8](https://github.com/eclipsesource/jsonforms/pull/1739) starting with version `v3.0.0-alpha.2`. Therefore if you want to use `ajv-errors` you will also need to update it now.

Also we reworked the internationalization support in JSON Forms in general. So this could be used instead of ajv-errors. There are no docs yet. Until they are available there is some information in [this issue](https://github.com/eclipsesource/jsonforms/issues/1840). A working example can be found in the example app of the [vuetify renderers](https://github.com/eclipsesource/jsonforms-vuetify-renderers).

---

<div class="post-metadata">

**Author:** ![Felix-Puetz](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/felix-puetz/32/85_2.png) [@Felix-Puetz](https://jsonforms.discourse.group/u/Felix-Puetz)\
**Post date:** [February 10, 2022, 2:54pm UTC](https://jsonforms.discourse.group/t/custom-error-messages/140/5 "2022-02-10T14:54:45Z")

</div>

And as a follow-up information:  
If you run into issues similar like this

 ![image](https://global.discourse-cdn.com/free1/uploads/jsonforms/original/1X/61763c2895c31e74df3efdbe8f60b8fef0a9fbc0.png)

You have to install ajv additionally  
`npm install ajv`

---

<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:** [November 28, 2023, 9:24am UTC](https://jsonforms.discourse.group/t/custom-error-messages/140/6 "2023-11-28T09:24:52Z")

</div>

As this post still receives views: The `i18n` support is now fully there for JSON Forms and provides a very easy mechanism for customizing error messages. See the docs [here](https://jsonforms.io/docs/i18n).
