All assumes " Shopify website forms" means things like contact forms in a theme for the online sales channel of a specific merchant store , and NOT the backend admin, or shopify’s own “website forms”.
Roughly you would just hook into the forms submission event like any other frontend html form.
The specifics will vary WILDLY between themes as some themes javascript will already be hooked into the submit event and may be set to stop propagation, and/or have completely custom submission functions. Then apps may be doing the same thing to frontend forms.
If you don’t need the data to actually be submitted to shopifys backedn at you could just replace the form entirely or it’s target action url putting the json into a hidden input depending on if the endpoint will consume json like that.
Yes, “you could just replace the form entirely or it’s target action url putting the json into a hidden input depending on if the endpoint will consume json like that.” - This will work. However, the docs do not explain and/or show how to do this. Would you be able to provide a code example please?