I have a JSON object as below upComingArray":
[
{
"companyAlias": "ABC",
"refNo": "ABC0001",
"Date": "12/09/2018",
"Sub": "ABC Subj" ...
},
{
"companyAlias": "ABC",
"refNo": "ABC0002",
"Date": "12/09/2018",
"Sub": "ABC Subj1" ...
},
{
"companyAlias": "ABC",
"refNo": "ABC0003",
"Date": "12/09/2018",
"Sub": "ABC Subj3"...
},
{
"companyAlias": "BCD",
"refNo": "BCD0001",
"Date": "14/09/2018",
"Sub": "BCD Subj"...
},
{
"companyAlias": "BCD",
"refNo": "BCD0002",
"Date": "14/09/2018",
"Sub": "BCD Subj2"...
},...
]
I would like to convert it to the below format for ease processing (basically group by companyAlias and Date)
upComingArray":
[
{
"companyAlias": "ABC",
"Date": "12/09/2018"
[ {
"refNo": "ABC0001"
"Sub": "ABC Subj"
},
{
"refNo": "ABC0002",
"Sub": "ABC Subj1"
},
{
"refNo": "ABC0003",
"Sub": "ABC Subj3"
}]
},
{
"companyAlias": "BCD",
"Date": "14/09/2018"
[
{
"refNo": "BCD0001",
"Sub": "BCD Subj"
},
{
"refNo": "BCD0002",
"Sub": "BCD Subj2"
}]
},...
]
If anyone have idea, Please let me know...
Thanks in Advance
The below code is working.