I have the following file,
{
"number": "12",
"question": "Sample Question",
"options": [
{
"text": "sample option 1",
"type": "check",
"isAnswer": "false"
},
{
"text": "sample option 2",
"type": "check",
"isAnswer": "false"
},
{
"text": "sample option 3",
"type": "check",
"isAnswer": "true"
},
{
"text": "sample option 4",
"type": "check",
"isAnswer": "true"
},
{
"text": "sample option 5",
"type": "check",
"isAnswer": "false"
}
],
"explanation": "sample explanation",
"reference": "sample ref"
}
I would like to re-order the lines in such a way that type comes before text.
{
"type": "check",
"text": "sample option 1",
"isAnswer": "false"
}
I know it is doable, I was able to swap some lines by using awk, but not getting the desired results. It seems to be an interesting problem, Can anyone help?