以下兩個JSON需要合并[ { "playerName": "小張", "updatedAt": "2017-03-28 10:03:57" }][ { "playerName": "小王", "updatedAt": "2017-03-28 10:03:57", }]需要把下面的JSON拼接成一個:[{"createdAt":"2017-03-25 13:38:55"playerName":"測試帳號"}][{"createdAt":"2017-03-28 10:03:57"playerName":"小王"}]希望的結果為:[{"createdAt":"2017-03-25 13:38:55"playerName":"測試帳號"},{"createdAt":"2017-03-2810:03:57"playerName":"小王"}]我用的代碼為:dataC = eval('('+(JSON.stringify(dataI.results)+JSON.stringify(dataB.results)).replace('\[\]',',')+')');請問如何能將把JSON中段的 [] 替換成 ,
js合并JSON時,replace替換中括號的問題
楊__羊羊
2018-11-22 13:11:33