How to send a JSON object using html form data

How to send a JSON object using html form data

So I’ve got this HTML form:

test





Which would be the easiest way to send this form’s data as a JSON object to my server when a user clicks on submit?
UPDATE:
I’ve gone as far as this but it doesn’t seem to work:

$.ajax({
  type: "POST",
  url: "serverUrl",
  data: formData,
  success: function(){},
  dataType: "json",
  contentType : "application/json"
});