0
我想将一些JSON转换为PHP中的关联数组。由于某种原因,json_decode()
的结果始终为NULL。json_decode不断返回null
我想我的JSON必须是畸形的,但我不知道为什么。什么是畸形的呢?
<?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);
是因为某些对象属性没有价值吗?
你的json无效请点击这里http://jsonlint.com/ – GBD