I have a json file that i want to read but the json_decode function in php always returns error the error is number 5 the utf8 one i use the utf8_decode function and try again it gives error number 4 the syntex error one but although i check it on jsonint validator can you guys help me ? here is the json :
{
"China": [
"Guangzhou",
"Fuzhou",
"Beijing",
"Baotou",
"Hohhot",
"Guiyang",
"Yinchuan",
"Nanjing",
"Changzhou",
"Chuzhou",
"Hefei",
"Jinan",
"Qingdao",
"Harbin",
"Zhaodong",
"Taiyuan",
"Xi'an",
"Xianyang",
"Shenzhen",
"Nanning",
"Zhengzhou",
"Xinxiang",
"Luohe",
"Luoyang",
"Chaoyang",
"Xingyi",
"Foshan",
"Haikou",
"Chengdu",
"Dongguan",
"Mingzhou",
"Chongqing",
"Zhuhai",
"Kunming",
"Wuhan",
"Xiling",
"Huizhou",
"Jiangmen",
"Shantou",
"Changxiacun",
"Zhongshan",
"Lhasa",
"Nanchang",
"Tianjin",
"Shanghai",
"Hebei",
"Shijiazhuang",
"Quanzhou",
"Putian",
"Xiamen",
"Chengyang",
"Zhangzhou",
"Sanming",
"Nanping",
"Baoding",
"Langfang",
"Yantai",
"Binzhou",
"Lanzhou",
"Yueqing",
"Zhongxin",
"Zhoushan",
"Hangzhou",
"Ningbo",
"Wenzhou",
"Changchun",
"Fuyang",
"Jieshou",
"Anqing",
"Wuhu",
"Shishi",
"Shishi",
"Weitang",
"Shenyang",
"Changsha",
"Yongjiawan",
"Lengshuijiang",
"Shijiazhuang",
"Xuchang",
"Suzhou",
"Xuzhou",
"Taizhou",
"Nanyang",
"Xinhua",
"Ürümqi",
"Yan'an Beilu",
"Baotao",
"Macao",
"Wuxi",
"Yangzhou",
"Baiyin",
"Tongren",
"Kunshan",
"Zhangjiagang"
]
}
and here is the php code :
<?php
$str=file_get_contents("countriesToCities.json");
$json =json_decode($str,true);
print_r( $json['China']);
?>