If I have the following JSON array:
[
{"data":
[
{"W":1,"A1":"123"},
{"W":1,"A1":"456"},
{"W":2,"A1":"4578"},
{"W":2,"A1":"2423"},
{"W":2,"A1":"2432"},
{"W":2,"A1":"24324"}
]
}
]
What is the best way to transform it into the format below?
[
{"1":[
{"A1":"123"},
{"A1":"456"}
]},
{"2":[
{"A1":"4578"},
{"A1":"2423"},
{"A1":"2432"},
{"A1":"24324"}
]}
]