I currently have a JSON object result
which looks like the following:
[
{
"Score_A": -112.166458,
"Score_B": 33.462795,
"Rating": 3,
"Team_Score": 5.01
},
{
"Score_A": -112.11248,
"Score_B": 33.510269,
"Rating": 3,
"Team_Score": 5.01
},
{
"Score_A": -112.06501,
"Score_B": 33.523769,
"Rating": 2,
"Team_Score": 5.02
}
]
I want to store this in a variable new_result
by removing the fields Rating
and Team_Score
. I also want to change the key for Score_A
and Score_B
to User1_Score
and User2_Score
respectively.
How can I do this?
Expected Result new_result
:
[
{
"User1_Score": -112.166458,
"User2_Score": 33.462795
},
{
"User1_Score": -112.11248,
"User2_Score": 33.510269
},
{
"User1_Score": -112.06501,
"User2_Score": 33.523769
}
]
Note: The length of result
is never constant.