jQuery key and it's value from a JSON array

I have a long JSON array from which I would like to remove a specific key and its value and then re-construct it as a JSON array.

How do I remove question_title from the following JSON array and then recreate it the same way?

[
{
  "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":""
 }
]

How do I go about it?

Answers


Assuming you have the JSON in a string called json_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);

You can delete the property from each object in the array once you parse it into an object with JSON.parse. Then, use JSON.stringify to produce new JSON.

The JSON object is supported in modern browsers; older browsers require a polyfill.


Need Your Help

How does Apps using Google App engine, cloud storage, datastore operate in China?

google-app-engine google-cloud-storage google-cloud-endpoints mobile-application google-datastore

Developing enterprise wide mobile application (android/iOS/Web) that would use Google Plaform - appengine, cloud endpoints, cloud storage, datastore etc.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.