Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.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
解析复杂的嵌套json对象_Json_Arrays_Jsonresult_Jsonobject - Fatal编程技术网

解析复杂的嵌套json对象

解析复杂的嵌套json对象,json,arrays,jsonresult,jsonobject,Json,Arrays,Jsonresult,Jsonobject,我有一些应用程序。下面是我从服务器上得到的关于考试的回复(这是一种在线考试) 考试将包含部分,部分将包含问题。给定的响应包含两个部分 { "Success": true, "Message": "Questions list", "Response": { "c_exam_name": "Verbal-Math", "exam_section_id": [ "SCjnqwh4vcng", "SCasqdesml6k" ], "sec

我有一些应用程序。下面是我从服务器上得到的关于考试的回复(这是一种在线考试)

考试将包含部分,部分将包含问题。给定的响应包含两个部分

{
"Success": true,
"Message": "Questions list",
"Response": {
    "c_exam_name": "Verbal-Math",
    "exam_section_id": [
        "SCjnqwh4vcng",
        "SCasqdesml6k"
    ],
    "section_ques_id": [
            "QUpg4r4s3by0w500",
            "QUcurdy54uzq5vsh",
            "QUmj8hsj0ulbff4p",
            "QU1a6zdiiq9zt347"
        ],
    "SCjnqwh4vcng": {
        "c_section_max_time": "7",
        "c_section_total_ques": 15,
        "QUpg4r4s3by0w500": {
            "c_q_type": "Multiple Option",
            "c_ques_info": {
                "question_info": {
                    "question": "<p>Poe's _______ reviews of contemporary fiction , which often find great merit in otherwise ________ literary gems, must make us respect his critical judgment in addition to his well-known literary talent.<\/p>",
                    "option_a": "thorough . . completed",
                    "option_b": "petulant . . unpopular",
                    "option_c": "insightful . . unappreciated",
                    "answer": "option_c"
                }
            },
            "c_section_id": "SCjnqwh4vcng"

        },
        "QUcurdy54uzq5vsh": {
            "c_q_type": "Multiple Option",
            "c_ques_info": {
                "question_info": {
                    "question": "<p>The significance of the Magna Carta lies not in ________ provisions, but in its broader impact : it made the king subject to the law.<\/p>",
                    "option_a": "specific",
                    "option_b": "revolutionary",
                    "option_c": "implicit",
                    "answer": "option_a"
                },
                "user_ans_info": "",
                "c_section_id": "SCjnqwh4vcng"
            }
        },
这里的技巧是,将动态生成对象的名称(部分ID和问题ID)


有谁能帮助我如何访问这些对象。

我认为你应该发布一个SSCE,这意味着删除令人困惑的屏幕截图,指明你感兴趣的确切JSON(而不是一个页面长的JSON字符串),并使问题足够通用,以便对其他人有用。这是一个很长的josn字符串。我想屏幕上的短片可以快速浏览整个josn。感谢您的建议如果您只需指出一个简短的JSON并准确地说出您想要解析的内容,那么您的问题就很容易回答。作为JSON嵌套,您只需要指出您感兴趣的嵌套。
success: function (msg) {
    resData = msg.Response;
    for (i = 0; i < msg.Response.exam_section_id.length; i++)
    {
        alert(resData.exam_section_id[i]);
        localStorage.setItem(resData.exam_section_id[i],
                             JSON.stringify(resData.exam_section_id[i]));

    }
}
alert(resData.exam_section_id[i].section_ques_id[0]);