so I have a form. When this form is submitted, I want to re-format it in a way which is "readable" by the back end. In this example, I have a survey. I want the generic structure to be like:
{
    survey_id: (string),
    responses:
    [
        {
            question: (String)
            answers: [ (String), ... ]
        },
        ...
    ]
}
I used this function to catch the form before it was submitted and log it:
submitSurvey : function( delay ) {
  $('#surveyForm').submit(function(e) {
    e.preventDefault();
    console.log(JSON.parse(JSON.stringify($(this).serializeArray())));
  });
});
However, when I submit my form, it comes out looking like this:
[{"name":"survey_id","value":"6"},
{"name":"do you like waffles?","value":"yeah we like waffles"},
{"name":"do you like pancakes?","value":"yeah we like pancakes"}] 
The first one is the id of the survey itself, and the next two are questions and their answers
How could I modify the output of the forms to match the format specified above before sending it to the backend?
 
     
    