How do I reset JSON Form widget inside the modal?

This question was asked by one of our users on Discord:

I was playing around with the recently released JSON forms, and I noticed that when I have a JSON form inside a modal, it doesn’t get cleared when the modal is closed.

This is manual behavior on Appsmith; to reset the states of any widgets, we can use the resetWidget() function.

You need to manually clear the JSON Form Widget as a parameter to the resetWidget function.

Example: {{resetWidget('JSONForm1')}}

More docs: https://docs.appsmith.com/framework-reference/resetwidget