I have a sample code:
$description = '{"2G Network":"GSM 850 / 900 / 1800 / 1900 ","3G Network":"HSDPA 850 / 900 / 1700 / 1900 / 2100 "}';
$data = json_decode($description);
echo $data->2G Network;
// OR echo $data['2G Network'];
result is error, how to fix it !
Try this:
echo $data->{'2G Network'};
The problem wasn't with JSON, but that you had a space in the object property you were trying to access. If you use curly braces { }, then you can use strings to name the property you want to get/set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With