Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Json获取数据值_Php_Jquery_Json - Fatal编程技术网

Php Json获取数据值

Php Json获取数据值,php,jquery,json,Php,Jquery,Json,我只需要获取id数据 {"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","co

我只需要获取id数据

{"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","country_id":"103"}}
需要进行jquery json解码吗

o/p:register.id

var jsondata='{"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","country_id":"103"}}';

var result=$.parseJSON(jsondata);

// OR

var result=JSON.parse(jsondata);

console.log(result.register.id); //result will be 1
请试试这个:

var obj ='{"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","country_id":"103"}}';

var json = JSON.parse(obj);

alert(json.register['id']);

请描述您的问题我想在jquery中解码上面的json对象可能的副本您使用ajax做什么