In Python, I would like to get all elements from my lists BIRD_answer and my_answer in a single row:
{
"BIRD_answer":[
[
0.043478260869565216
],
[
0.07042253521126761
],
[
0.11363636363636363
]
],
"my_answer":[
[
"MillenniumHighAlternative",
0.043478260869565216
],
[
"RanchodelMarHigh(Continuation)",
0.07042253521126761
],
[
"DelAmigoHigh(Continuation)",
0.11363636363636363
]
]
}
To give me a format like this :
"BIRD_answer":[[0.043478260869565216],[0.07042253521126761],[0.11363636363636363]],
"my_answer":[["MillenniumHighAlternative",0.043478260869565216],["RanchodelMarHigh(Continuation)",0.07042253521126761],["DelAmigoHigh(Continuation)",0.11363636363636363]]
}
I have already tried to use jsbeautifier but doesn’t work.
2
Answers
You can do it using
json.dumps
Result :
Hope it helps you!
You will need to devise a custom formatter:
This will result in:
Here is a more compact function: