document.querySelector('form') // Your form .addEventListener('submit', e => { e.preventDefault(); const data = Object.fromEntries( new FormData(e.target) ); // Store it as JSON const jsonData = JSON.stringify(data); });