I'm using a Recharge API. The API receives the response in Json format. I need to store a output value in variable from the Json response in PHP.
// Response received from API url
$output = '{"data":[{"user":"abcd123","bal":"500","error_code":200,"resText":"Success"}]}';
//Decoding output
$json = json_decode($output, true);
//Print
print_r($json);
//Store a value as variable
$bal = $json['bal'];
Getting error that bal is undefined index.
Please help me with the proper way to get the value of bal in the variable $bal from the API response.
print_r($json);and following the structure.