I'm trying to convert some JSON to an associate array in PHP. For some reason, the result of json_decode()
is always NULL.
I guess my JSON must be malformed, but I don't know why. What's malformed about it?
<?php
$json = '{ markers:{ marker:[ { lat:50.30644, lng:18.03125, title:"Some name with accented characters ÅÄÖ", zoom:13, center:"false", street:"Dalahästvägen 56", zip:{ }, city:"117 58 MALMÖ", country:"SE", phone:"070-880 60 14", www:"domain.se/" }, { lat:59.5306, lng:18.08521, title:"ACME INC", zoom:13, center:"false", street:"ELFSBORGSVÄGEN 9", zip:{ }, city:"186 41 SIGTUNA", country:"SE", phone:"08-511 700 70", www:"acmegiantslingshots.se" }]}}' ;
$arr = json_decode($json, true);
print_r($arr);
Is it because some of the object properties have no value?