DHIS2 bulk custom elements json payload

jsonPayload = JSON.stringify({
    "name"      : customElementString.name,
    "shortName" : customElementString.shortName,
    "aggregationType": customElementString.aggregationType,
    "domainType": customElementString.domainType,
    "valueType" : customElementString.valueType,
    "code"      : updateArray[i].value,
    "displayName": customElementString.displayName,
    "displayShortName": customElementString.displayShortName,
    "displayFormName" : customElementString.displayFormName,
    "formName"        : customElementString.formName,
    "url"      : customElementString.url,
    "optionSet": {
        "id": customElementString.optionSet.id
    },
    "categoryCombo": {
        "id": customElementString.categoryCombo.id
    }
  });

Another way: 

let customElementString = response.data;
let jsonPayload = JSON.stringify({
 ...customElementString
 code: updateArray[i].value
});