Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/88.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
Javascript jQuery键和it';从JSON数组中提取值_Javascript_Jquery_Json - Fatal编程技术网

Javascript jQuery键和it';从JSON数组中提取值

Javascript jQuery键和it';从JSON数组中提取值,javascript,jquery,json,Javascript,Jquery,Json,我有一个长JSON数组,我想从中删除一个特定的键及其值,然后将其重新构造为JSON数组 如何从以下JSON数组中删除question\u title,然后以相同的方式重新创建它 [ { "question_title":"1110112x100012 (equal to)", "new_attempt_id":"ATT-1187", "unique_question_code":"QUES-1140", "questions":[ { "op_key":

我有一个长JSON数组,我想从中删除一个特定的键及其值,然后将其重新构造为JSON数组

如何从以下JSON数组中删除
question\u title
,然后以相同的方式重新创建它

[
{
  "question_title":"1110112x100012 (equal to)",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1140",
  "questions":[
     {
        "op_key":1,
        "op_val":"111101101"
     },
     {
        "op_key":2,
        "op_val":"111101100"
     },
     {
        "op_key":3,
        "op_val":"1111101011"
     },
     {
        "op_key":4,
        "op_val":"1100110"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"Information related to functioning of organization such as project plans is ________ information",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1142",
  "questions":[
     {
        "op_key":1,
        "op_val":"Internal use only"
     },
     {
        "op_key":2,
        "op_val":"Confidential"
     },
     {
        "op_key":3,
        "op_val":"Proprietary"
     },
     {
        "op_key":4,
        "op_val":"Business"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"Conceptual schema is a definition of the total database.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1147",
  "questions":[
     {
        "op_key":1,
        "op_val":"TRUE"
     },
     {
        "op_key":2,
        "op_val":"FALSE"
     },
     {
        "op_key":3,
        "op_val":""
     },
     {
        "op_key":4,
        "op_val":""
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"The schema for the external and internal levels is kept by the database in its System Tables.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1132",
  "questions":[
     {
        "op_key":1,
        "op_val":"TRUE"
     },
     {
        "op_key":2,
        "op_val":"FALSE"
     },
     {
        "op_key":3,
        "op_val":""
     },
     {
        "op_key":4,
        "op_val":""
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"What is the role of software in DBMS?",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1149",
  "questions":[
     {
        "op_key":1,
        "op_val":"Storing and managing the data"
     },
     {
        "op_key":2,
        "op_val":"Managing user"
     },
     {
        "op_key":3,
        "op_val":"Physically storing data"
     },
     {
        "op_key":4,
        "op_val":"All of the above"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"__________ databases are generally splitted by using a common delimiter.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1144",
  "questions":[
     {
        "op_key":1,
        "op_val":"Advanced"
     },
     {
        "op_key":2,
        "op_val":"Relational"
     },
     {
        "op_key":3,
        "op_val":"Structured"
     },
     {
        "op_key":4,
        "op_val":"Flat file"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
},
{
  "question_title":"Tally is a type of ERP.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1137",
  "questions":[
     {
        "op_key":1,
        "op_val":"TRUE"
     },
     {
        "op_key":2,
        "op_val":"FALSE"
     },
     {
        "op_key":3,
        "op_val":""
     },
     {
        "op_key":4,
        "op_val":""
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
},
{
  "question_title":"Data by itself is not useful unless",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1141",
  "questions":[
     {
        "op_key":1,
        "op_val":"It is massive"
     },
     {
        "op_key":2,
        "op_val":"It is processed to obtain information"
     },
     {
        "op_key":3,
        "op_val":"It is collected from diverse sources"
     },
     {
        "op_key":4,
        "op_val":"It is properly stated "
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"Pay slip and Bio-data are example of what kind of information?",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1145",
  "questions":[
     {
        "op_key":1,
        "op_val":"Business"
     },
     {
        "op_key":2,
        "op_val":"Personal"
     },
     {
        "op_key":3,
        "op_val":"General"
     },
     {
        "op_key":4,
        "op_val":"AtalpahdHelloB"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"The most commonly used system for representing signal binary numbers is the ________",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1150",
  "questions":[
     {
        "op_key":1,
        "op_val":"1?s complement system"
     },
     {
        "op_key":2,
        "op_val":"2?s complement system"
     },
     {
        "op_key":3,
        "op_val":"Complement system"
     },
     {
        "op_key":4,
        "op_val":"Sign magnitude "
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"CGI is ______",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1139",
  "questions":[
     {
        "op_key":1,
        "op_val":"Computer generated imaging"
     },
     {
        "op_key":2,
        "op_val":"Computer generated interface"
     },
     {
        "op_key":3,
        "op_val":"Computer graphical information"
     },
     {
        "op_key":4,
        "op_val":"Computer generated information"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"Database is a _________ of data structured in such a way that it may serve various applications.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1135",
  "questions":[
     {
        "op_key":1,
        "op_val":"System"
     },
     {
        "op_key":2,
        "op_val":"Folder"
     },
     {
        "op_key":3,
        "op_val":"Method"
     },
     {
        "op_key":4,
        "op_val":"File"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"A management information system is one which",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1134",
  "questions":[
     {
        "op_key":1,
        "op_val":"Is required by all managers of an organization"
     },
     {
        "op_key":2,
        "op_val":"Processes data to yield information of value in tactical management"
     },
     {
        "op_key":3,
        "op_val":"Provides operational information"
     },
     {
        "op_key":4,
        "op_val":"Allows better management of organizations"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"______ Technology, enabled internet access on mobile phones.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1138",
  "questions":[
     {
        "op_key":1,
        "op_val":"SAP"
     },
     {
        "op_key":2,
        "op_val":"WAP"
     },
     {
        "op_key":3,
        "op_val":"GSM"
     },
     {
        "op_key":4,
        "op_val":"PCS"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"There can be n number of primary keys in a table.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1131",
  "questions":[
     {
        "op_key":1,
        "op_val":"TRUE"
     },
     {
        "op_key":2,
        "op_val":"FALSE"
     },
     {
        "op_key":3,
        "op_val":""
     },
     {
        "op_key":4,
        "op_val":""
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"Database management systems are intended to?_____?",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1133",
  "questions":[
     {
        "op_key":1,
        "op_val":"Eliminate data redundancy"
     },
     {
        "op_key":2,
        "op_val":"Establish relationship among records in different files"
     },
     {
        "op_key":3,
        "op_val":"Manage file access"
     },
     {
        "op_key":4,
        "op_val":"All of the above"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"_________ software that automatically converts images into text.",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1148",
  "questions":[
     {
        "op_key":1,
        "op_val":"CGI"
     },
     {
        "op_key":2,
        "op_val":"Bluescreen"
     },
     {
        "op_key":3,
        "op_val":"OCR"
     },
     {
        "op_key":4,
        "op_val":"MICR "
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"Binary multiplication 1x0 (equals to)",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1143",
  "questions":[
     {
        "op_key":1,
        "op_val":"1"
     },
     {
        "op_key":2,
        "op_val":"0"
     },
     {
        "op_key":3,
        "op_val":"10"
     },
     {
        "op_key":4,
        "op_val":"11"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"Office automation systems that are capable of sharing information simultaneously, between more than one user, are termed as _______",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1136",
  "questions":[
     {
        "op_key":1,
        "op_val":"Cluster systems"
     },
     {
        "op_key":2,
        "op_val":"Meeting systems"
     },
     {
        "op_key":3,
        "op_val":"Multiple-user systems"
     },
     {
        "op_key":4,
        "op_val":"Groupware systems"
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 },
 {
  "question_title":"What is redundant data?",
  "new_attempt_id":"ATT-1187",
  "unique_question_code":"QUES-1146",
  "questions":[
     {
        "op_key":1,
        "op_val":"Private Data"
     },
     {
        "op_key":2,
        "op_val":"Duplicate Data"
     },
     {
        "op_key":3,
        "op_val":"Extra Data"
     },
     {
        "op_key":4,
        "op_val":"Meaningless Data "
     }
  ],
  "selected_answer":"",
  "selected_after_shuffle":"",
  "marked_for_review":"",
  "attempted":""
 }
]

我该怎么做呢?

假设JSON是一个名为
JSON\u content
的字符串:

var question_list = JSON.parse(json_content);

for(var i=0; i < question_list.length; ++i) {
    var question = question_list[i];
    delete question["question_title"];
}

var new_json_content = JSON.stringify(question_list);
var question\u list=JSON.parse(JSON\u内容);
对于(变量i=0;i
使用
JSON.parse
将数组中的每个对象解析为一个对象后,就可以从中提取属性。然后,使用
JSON.stringify
生成新的JSON


现代浏览器支持
JSON
对象;较旧的浏览器需要一个.

你能详细解释一下“以同样的方式重新创建”是什么意思吗?这个问题可能对你很有用:我想保持相同的JSON结构,只需从可能重复的i do a console.log(新的JSON内容)中删除问题标题,但问题标题似乎仍然存在