0

Below the input object send to api

var inputArray = {
    ...inputArray,
        data:{
            ...inputArray.data,
            firstName:'',
            secondOne:'',
            Third:'',
            Last-Name:'',               
        }
    }; 




var firstName = response[0].firstName;
    var secondOne = response[0].secondOne;
    var Third = response[0].Third;
    var lastName = response[0].lastName;

assign the values to input object

inputArray.data.firstName = firstName;
    inputArray.data.secondOne = secondOne;
    inputArray.data.Third = Third;
    inputArray.data.Last-Name = lastName;

lastname input object contains inputArray.data.Last-Name = lastName; hyphen ,when i try to send like above showing error.how to send hyphen input parameters to api

John Ken
  • 898
  • 1
  • 13
  • 26
  • 1
    In an object literal, quote the key name... `{ "Last-Name": "" }`. When assigning to an object, use square-bracket notation... `inputArray.data["Last-Name"] = lastName` – Phil Sep 28 '21 at 03:37
  • @Phil : it is working fine. thanks – John Ken Sep 28 '21 at 03:45

0 Answers0