code: function convertObjectToJSON(data) {
        const delimiter = '_'
        let result = {}
        let arrays = {}
        data.forEach(item => {
          const value = item.value
          if (value !== '') {
            if (!item.name) return
            let name = item.name
            let nameParts = name.split(delimiter)
            let currResult = result
            for (let j = 0; j < nameParts.length; j++) {
              const namePart = nameParts[j]
              let arrName
              if (namePart.indexOf('[]') > -1 && j === nameParts.length - 1) {
  
                arrName = namePart.substr(0, namePart.indexOf('['))
                if (!currResult[arrName]) {
                  currResult[arrName] = []
                }
                currResult[arrName].push(value)
              } else {
                if (namePart.indexOf('[') > -1) {
                  arrName = namePart.substr(0, namePart.indexOf('['))
                  const arrIdx = namePart.replace(/^[a-z]+\[|\]$/gi, '')
                  if (!arrays[arrName]) {
                    arrays[arrName] = {}
                  }
                  if (!currResult[arrName]) {
                    currResult[arrName] = []
                  }
                  if (j === nameParts.length - 1) {
                    currResult[arrName].push(value)
                  } else {
                    if (!arrays[arrName][arrIdx]) {
                      currResult[arrName].push({})
                      arrays[arrName][arrIdx] = currResult[arrName][currResult[arrName].length - 1]
                    }
                  }
                  currResult = arrays[arrName][arrIdx]
                } else {
                  if (j < nameParts.length - 1) {
                    if (!currResult[namePart]) {
                      currResult[namePart] = {}
                    }
                    currResult = currResult[namePart]
                  } else {
                    currResult[namePart] = value
                  }
                }
              }
            }
          }
        })
        return result
      }
docs: Convert form names and values to JSON: