What I am trying to do exceeds my knowledge. Thank you all for your time and help, it is a great pleasure to have the support of such a large community of great developers.
The problem
I need to loop over an object (JSON response) to determine which data is true and then edit the html with the results.
json object is:
var data = {
"total": 4,
"limit": 50,
"questions": [{
"date_created": "2015-06-29T18:24:25.000-04:00",
"item_id": "MLA567045929",
"seller_id": 186626557,
"status": "UNANSWERED",
"text": "Pregunta de Testeo, user 2.",
"id": 3612747353,
"deleted_from_listing": false,
"hold": false,
"answer": null,
"from": {
"id": 186625262,
"answered_questions": 0
}
}, {
"date_created": "2015-06-29T18:30:16.000-04:00",
"item_id": "MLA567045929",
"seller_id": 186626557,
"status": "UNANSWERED",
"text": "Lorem ipsum dolor sit amet",
"id": 3612938882,
"deleted_from_listing": false,
"hold": false,
"answer": null,
"from": {
"id": 186625262,
"answered_questions": 0
}
}, {
"date_created": "2015-06-29T18:30:35.000-04:00",
"item_id": "MLA567045929",
"seller_id": 186626557,
"status": "UNANSWERED",
"text": "an est odio timeam quaerendum",
"id": 3612752695,
"deleted_from_listing": false,
"hold": false,
"answer": null,
"from": {
"id": 186625262,
"answered_questions": 0
}
}, {
"date_created": "2015-06-29T18:31:32.000-04:00",
"item_id": "MLA567045929",
"seller_id": 186626557,
"status": "ANSWERED",
"text": "Responder esta pregunta",
"id": 3612753455,
"deleted_from_listing": false,
"hold": false,
"answer": {
"text": "Pregunta respondida",
"status": "ACTIVE",
"date_created": "2015-06-29T18:31:58.000-04:00"
},
"from": {
"id": 186625262,
"answered_questions": 1
}
}],
"filters": {
"limit": 50,
"offset": 0,
"is_admin": false,
"sorts": [],
"caller": 186626557,
"seller": "186626557"
},
"available_filters": [{
"id": "item",
"name": "Item",
"type": "text"
}, {
"id": "from",
"name": "From user id",
"type": "number"
}, {
"id": "totalDivisions",
"name": "total divisions",
"type": "number"
}, {
"id": "division",
"name": "Division",
"type": "number"
}, {
"id": "status",
"name": "Status",
"type": "text",
"values": ["BANNED", "CLOSED_UNANSWERED", "DELETED", "DISABLED", "UNDER_REVIEW"]
}],
"available_sorts": ["item_id", "from_id", "date_created", "seller_id"]
};
The result I'm looking for is:
Of the data object, I need to extract questions with the status unanswered and the id field associated with these unanswered questions.
"questions1":[{ "status" : "UNANSWERED",
"id" : 3612747353}],
"questions2":[{ "status" : "UNANSWERED",
"id" : 3612938882}],
...
Based on what I've searched, I've tried with loops, for in, and each without success.
Any suggestions or ideas on how I could achieve the desired result? I need to apply this example to several objects.