I have this object containing HTML:
obj = {
   amount: 0
   apply_business_delivery: "<div class="form-check"><input type="checkbox" checked class="form-check-input" name="apply_business_delivery" id="apply_business_delivery"></div>"
   apply_private_delivery: "<div class="form-check"><input type="checkbox" checked class="form-check-input" name="apply_private_delivery" id="apply_private_delivery"></div>"
   bin: "<i class="far fa-trash-alt"></i>"
   service: "E-mail advisering"
   unit: "<div class="form-group"><select class="form-control form-control-sm select2" name="units" id="units"><option selected>Kr.</option><option >%</option></select></div>"
}
Can I somehow convert these values to a form-serialized data making it easier to work with serverside? For instance checkbox should be converted into 0 or 1 if it's checked.
Edit:
Want I would like, is to have an identical function like $('form').serializeArray(). I'm just having have problems figuring out how I can do this on an obj.
For instance $('form').serializeArray() convert this HTML:
<select class="form-control form-control-sm select2" name="company_name"
        id="company_name">
    <option>My company</option>
</select>
<select class="form-control form-control-sm select2" name="type"
        id="type">
    <option>Business</option>
</select>
To this:
 "form" => array:2 [
    0 => array:2 [
      "name" => "company_name"
      "value" => "My company"
    ]
    1 => array:2 [
      "name" => "type"
      "value" => "Business"
    ]
  ]
This is the result I want:
obj = {
   amount: 0
   apply_business_delivery: [
      "name" => "apply_business_delivery"
      "value" => 1
   ]
   apply_private_delivery: [
      "name" => "apply_private_delivery"
      "value" => 1
   ]
   bin: ""
   service: "E-mail advisering"
   unit: [
      "name" => "units"
      "value" => "Kr."
   ]
}
 
     
    
