Hello,
I am trying to add data to jsonarray but after adding object it’s adding empty data which I don’t want to add. How I can do that.
Code
var id = pm.environment.get(‘id’);
var jsonArr = [{}];
for (let i = 1; i < 8; i++) {
var currentDate = moment().subtract(i, ‘day’);
var dt = currentDate.format(“YYYY-MM-DD”)
jsonArr.push({“id”:id,“start_date”:dt,“score”: ${_.random(0, 100)}
,“has_valid_frac_valid”: false,“has_valid_baseline”: false});
}
Output.
[{},{“id”:119517,“start_date”:“2021-11-13”,“score”:“8”,“has_valid_frac_valid”:false,“has_valid_baseline”:false},{“id”:119517,“start_date”:“2021-11-12”,“score”:“71”,“has_valid_frac_valid”:false,“has_valid_baseline”:false}}]
Thanks in Advance.