I have a JSON file that needs to be arranged based on three specific fields.
Here is an example snippet of the JSON data:
{
"Racename": "10KM",
"Category": 34,
"Gender": "Male",
"Work": "Google",
"FullName": "Dave Happner",
"Rank": 1,
"Ponit": 1,
"Numparticipant": 0,
"rankparticipant": 0,
"precentagePart": "0",
"NumRaces": 1,
"RaceTime": "2018-10-18T00:34:20",
"rankCat": 1,
"PointCat": 1,
"RaceDate": "2018-10-05"
}
The desired output (using underscore
or lodash
) should be structured like this:
[
{
"Racename" : "10KM",
"Category": "34",
"Gender": "Male",
runner : [
{
"Work": "Google",
"FullName": "Dave Happner",
"Rank": 1,
"Ponit": 1,
"Numparticipant": 0,
"rankparticipant": 0,
"precentagePart": "0",
"NumRaces": 1,
"RaceTime": "2018-10-18T00:34:20",
"rankCat": 1,
"PointCat": 1,
"RaceDate": "2018-10-05"
}
]
}