I am able to POST data with curl in the JSON format with the loop in bash script
Current
$(curl -o /dev/null -s -X POST “${url}" -H "accept: application/json" -H "Authorization: ${base}” -H "Content-Type: application/json" -d “{\”data1\”:\”${data1}\”,\”data2\”:\”${data2}\”}”)
[
{
"data1": "data1",
"data2”: "data2”
},
{
"data3”: "data3”,
"data4”: "data4”
}
]
But my requirement is to achieve below format in JSON array with curl. Please help me to achieve me to append JSON with curl command with every iteration of loop.
{“Array": [
{
"data1": "data1",
"data2”: "data2”
},
{
"data3”: "data3”,
"data4”: "data4”
}
]
}