我有一个 JSON 对象,如下所示 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"...
},...
]
我想将其转换为以下格式以便于处理(基本上按公司别名和日期分组)
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"
}]
},...
]
如果有人有想法,请告诉我...
提前致谢