我得到JSON響應形式iPhone應用程序如下JSON解碼
{"json":{"age":"23","userid":"1","weight":"55","fullname":"goutham"}};
任何一個可以告訴我如何將其解碼..
我得到JSON響應形式iPhone應用程序如下JSON解碼
{"json":{"age":"23","userid":"1","weight":"55","fullname":"goutham"}};
任何一個可以告訴我如何將其解碼..
使用PHP的功能:json_decode
<?php
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));
var_dump(json_decode($json, true));
?>
來源:從上述參考手冊
使用json_decode實施例
$array = json_decode($string, true);
/// please note the second parameter 'true' here, it is needed if you want your o/p as array or you will get it as object
print_r($array);
您可以使用
json_decode();
像
json_decode($my_json);
,或者你可以像使用json_code.age;像 json_code.userid請參閱本http://php.net/manual/en/function.json-decode.php
,或者你可以參考這個onlinr轉換器http://json.parser.online.fr/
,我認爲我們在這裏失蹤的問題,從u所提供的JSON字符串看,你可以清楚地看到你有它的屬性的對象。
看一看JSON的規格http://www.json.org/
{JSON:{年齡:23等
我希望通過做json_decode它ü將能夠獲取對象的屬性通過簡單地說, :$ json-> age
希望這會有所幫助
http://php.net/manual/en/function.json-decode.php – koopajah