You need to use an array, not a regular variable.
curl_std_opts=( -k --header 'Content-Type: application/json' --header 'Accept: application/json')
curl "${curl_std_opts[@]}" -X POST --data "{\"actual\": $BAL}" "$websiteurl"
For safety, you should use a tool like jq
to generate your JSON rather than relying on parameter interpolation to generate valid JSON.
curl "${curl_std_opts[@]}" -X POST --data "(jq --argjson b "$BAL" '{actual: $b}') "$websiteurl"
2
solved Pass variable as options to curl in shell script linux [duplicate]