title: Convert JSON string to an array in multistep Form in JavaScript?
body: <p>I am working on dynamic multi step form .
  <strong>What I am doing :</strong> 
  1. creating input fields using AJAX 
  2. taking input field info from user
  3. serializeArray()
  4. SUbmit (POST) : before submit convert input values into desired format ex: input <code>type=date</code> convert into utc format, which is working fine.</p>
  
  <p>I have multi step format , in first step , I have two fields which has Student Number, Id  <code>type=list</code>(to create array) then click on next button and then I have second step form which has Name , date , address.<br>
   I am converting date on submit using below code </p>
  
  <pre><code>var dateTypeField = $('form').find('input[type="date"]').attr('name');
          var dateField = $('form').find('input[type="date"]').val();
          var dateFormat = '';
  if (dateField) {
                  dateFormat = moment.utc(dateField).format('YYYY-MM-DDThh:mm:ss.SSSZ');
              }
              else {
                  dateFormat = null;
              }
  </code></pre>
  
  <p>which is working fine .</p>
  
  <p><strong>Question</strong> :  I have two input fields in first step which has <code>type=list</code> , and value in string , I want to convert string into an array while clicking on submit. this is what I am doing </p>
  
  <pre><code>var listTypeField = $('form').find('input[type="list"]').attr('name');
              var inputTypeList = $('form').find('input[type="list"]').val();
              listTypeField = inputTypeList.split(',');
              var listFormat = inputTypeList.split(',');
  
              var formData = $form.serializeArray();
  
              formData.push({ name: dateTypeField, value: dateFormat });
              formData.push({ name: listTypeField, value: inputTypeList });
  </code></pre>
  
  <p><strong>Issue</strong> : 1. I have two fields which has type= list , but showing only one field using <code>$('form').find('input[type="list"]').attr('name')</code>  2. spilt is undefined . 3. How to convert string into an array after serializeArray()? <code>formData.push({ name: listTypeField, value: inputTypeList });</code> not working for me. I want <a href="https://i.stack.imgur.com/qOD4n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qOD4n.png" alt="enter image description here"></a> </p>