'JSON grouping by keys
here is one my challeng is that I have a json object, I want to do grouping on it like below, please help me. I have a JSON array as :
[
{
"subscriptionId": 1,
"subscriptionName": "VIP",
"description": "Vip Subscription",
"subscriptionPoint": "1",
"sortOrder": 1
},
{
"subscriptionId": 1,
"subscriptionName": "VIP",
"description": "Vip Subscription",
"subscriptionPoint": "VIP",
"sortOrder": 2
}
]
I want to group the data by subscriptionName like below
[
{
"subscriptionId": 1,
"subscriptionName": "VIP",
"description": "Vip Subscription",
"points":
[{
"subscriptionPoint": "1",
"sortOrder": 1
},
{
"subscriptionPoint": "VIP",
"sortOrder": 2
}]
}
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
