**我想转换json响应并显示值**
<?php
// json string
$json_string = '{
"message": "Successfully retrived",
"error": false,
"result": [{
"id": 6128071,
"name": "jhon doe",
"number": "31231231230",
"city": "C",
"cnic": "8982378237897278",
"address": "address123",
"activation_date": "0"
}]
}';
// decode json string
$json_array = json_decode($json_string, true);
?>
// Print Values
Name : <?=$json_array['result']['name']?><br>
Number: <?=$json_array['result']['number']?><br>
Cnic: <?=$json_array['result']['cnic']?><br>
Address : <?=$json_array['result']['address']?><br>
activation date: <?=$json_array['result']['activation_date']?>
但是我在这条线上出错了
$ json_array ['result'] ['name'];
注意:未定义索引:名称
请指导我如何解决此错误。我尝试搜索Google,但未找到任何解决方案。