Apologies for the lack of knowledge in French and for asking what may seem like a silly question, but I need assistance with removing certain elements from a JSON file despite being unfamiliar with JSON and JS.
The structure is as follows: `
{ "questions": [
{
"id": 1,
"quizId": 1,
"question": "Which vehicle is allowed to stop within the area covered by these signs?",
"correctAnswer": 4,
"image": "1.jpg",
"answers": [
"To the red one.",
"To both vehicles.",
"To neither.",
"To neither.",
"To the yellow one marked with the identifier sign \"Disabled\".",
"-"
]
},
{
"id": 2,
"quizId": 1,
"question": "In which directions indicated by the arrows is movement permitted?",
"correctAnswer": 4,
"image": "2.jpg",
"answers": [
"Only in direction A.",
"Only in direction B.",
"Only in direction C.",
"-",
"-",
"-"
]
}
]
}
I am looking to identify elements within the answers array that equal "-"
and remove them.
Therefore, the desired output should be:
{ "questions": [
{
"id": 1,
"quizId": 1,
"question": "Which vehicle is allowed to stop within the area covered by these signs?",
"correctAnswer": 4,
"image": "1.jpg",
"answers": [
"To the red one.",
"To both vehicles.",
"To neither.",
"To neither.",
"To the yellow one marked with the identifier sign \"Disabled\"."
]
},
{
"id": 2,
"quizId": 1,
"question": "In which directions indicated by the arrows is movement permitted?",
"correctAnswer": 4,
"image": "2.jpg",
"answers": [
"Only in direction A.",
"Only in direction B.",
"Only in direction C."
]
}
]
}
I attempted to solve the problem on my own without success. Thank you for any guidance provided!