DEV Community

Discussion on: How to easily convert HTML Form to JSON

 
ndrean profile image
NDREAN • Edited

If you POST, I believe you can do directly body: new FormData(e.target)
if you GET and adjoin a query string, you may indeed need URLSearchParams

Thread Thread
 
austingil profile image
Austin Gil

Ah yes. This is true. My only issue with this is using FormData in the request body changes the request headers from the default application/x-www-form-urlencoded to multipart/form-data. This has caused me issues before, so I try to avoid it.