js中的嵌套json数据 - 从嵌套数组中获取值

Got the output result in json nested array.

Help to access the USER-id of this json format .

var result = {
    "USER": {
        "id": "11456",
        "email": "g@gmail.com",
        "name": "g"
    },
    "status": "true",
    "group-title": "title",
    "group-name": "2-Group"
}

json values are not seperated by

 ;

the correct formate for your json is

var result =  {"status":"true","USER":{"id":"11456","name":"g","email":"g@gmail.com"},
                "group-name":"2-Group","group-title":"title"}

for this formate u can assess the user id by

    result.USER.id;

I thin your json structue is wrong. Below is the corrected structure

{
  "status": "true",
  "USER": {
    "id": "11456",
    "name": "g",
    "email": "g@‌​gmail.com"
  },
  "group-name": "2-Group",
  "group-title": "title"
}

The json usages in JS

 var result={  "status": "true",  "USER": {    "id": "11456",    "name": "g",    "email": "g@‌​gmail.com"  },  "group-name": "2-Group",  "group-title": "title"};
resultJson=jQuery.parseJSON(result);

var userId=resultJson.USER.id; // here you will get the user id

Please try this way. This may help you. Don't forget to add jQuery in your script

From your code, you can directly access Id as below:

<script>
var result = {
    "USER": {
        "id": "11456",
        "email": "g@gmail.com",
        "name": "g"
    },
    "status": "true",
    "group-title": "title",
    "group-name": "2-Group"
};

alert(result.USER.id);
</script>