I want to know how can we create const object variable with array, in which when we add item it should not contain index object.
e.g.
const estimateData = {
'customerId': customerId,
'vehicleInformation': {},
'datalines': []
};
Here, When I add items in datalines, it always comes with key-value pair like below.
"datalines": [
0 : {
"lineNumber": 1,
...
},
1 : {
"lineNumber": 2,
...
}
]
Because of this my webservice returns exception with error like
error: "Bad Request"
exception: "com.alldata.estimator.exceptions.BadRequestException"
message: "unknown dataline type 0"
path: "/estimator/estimates/211204"
So my question is how can I remove that 0,1 indexes so my request can be passed successfully and data can be approved. I have tried to add data via push, reassigning array, forEach loop but nothing worked.
// I am trying to add data in array by following methods, but nothing works.
this.selectedEstimate.datalines.forEach((lineItem: ILineItem) => {
estimateData.datalines.push(lineItem);
});
// estimateData.datalines = this.selectedEstimate.datalines;
I have also tried to parse data from JSON, but not worked.
Please let me know where is the issue and how can I solve this. Thanks in Advance.