私が与えたjsonオブジェクトは次のとおりです。
resultTable = [
{
id: "005470021180",
balance: "0.00",
accountName: "Money Master",
category: "Banking",
currency: "CAD",
entitlements: [
]
},
{
id: "005470021288",
balance: "0.00",
accountName: "Money Master",
category: "Banking",
currency: "CAD"
},
{
id: "005470044628",
balance: "-72,116.01",
accountName: "Money Master",
category: "Banking",
currency: "CAD"
},
{
id: "40592000495201",
accountName: "Business Loan",
category: "Borrowing",
cad_balance: "0.00"
},
{
id: "40592000495202",
accountName: "Business Loan",
category: "Borrowing",
cad_balance: "0.00"
},
{
id: "40592000495203",
accountName: "Business Loan",
category: "Investing",
cad_balance: "0.00"
},
{
id: "40592000495204",
accountName: "Business Loan",
category: "INVESTING",
cad_balance: "0.00"
},
{
usd_balance: "1,080.27",
id: "55300070",
accountName: "Scotia iTRADE",
category: "INVESTING",
cad_balance: "272,166.59"
}
];
JSで次のような出力が必要です:
resulttable = [
{
"Banking": {
id: "005470021180",
balance: "0.00",
accountName: "Money Master",
category: "Banking",
currency: "CAD",
entitlements: [
]
},
{
id: "005470021288",
balance: "0.00",
accountName: "Money Master",
category: "Banking",
currency: "CAD"
},
{
id: "005470044628",
balance: "-72,116.01",
accountName: "Money Master",
category: "Banking",
currency: "CAD"
}
},
{
"Borrowing": {
id: "40592000495201",
accountName: "Business Loan",
category: "Borrowing",
cad_balance: "0.00"
},
{
id: "40592000495202",
accountName: "Business Loan",
category: "Borrowing",
cad_balance: "0.00"
}
},
{
""INVESTING":{
{
id : "40592000495203",
accountName : "BusinessLoan",
category : "Investing",
cad_balance : "0.00"
},
{
id : "40592000495204",
accountName : "BusinessLoan",
category : "INVESTING",
cad_balance : "0.00"
},
{
usd_balance : "1,080.27",
id : "55300070",
accountName : "ScotiaiTRADE",
category : "INVESTING",
cad_balance : "272,166.59"
}} ];