一、多个JSON对象合并为一个对象

1、利用JSON.parse和JSON.stringify合并

var json1 = {name: 'lily'};
var json2 = {age: 18};
var json3 = {hobby: '画画'}
var a = JSON.parse((JSON.stringify(json1) + JSON.stringify(json2)).replace(/}{/, ','));
console.log(a); //{name: 'lily',age: 18}
var json = JSON.parse((JSON.stringify(a) + JSON.stringify(json3)).replace(/}{/, ','));
console.log(json); //{name: 'lily',age: 18,hobby: '画画'}

2、利用扩展运算符合并

var json1 = {
        name: 'lily'
    };
    var json2 = {
        age: 18
    };
    var json3 = {
        hobby: '画画'
    };
     var json = {
        ...json1,
        ...json2,
        ...json3
    };
    console.log(jsona); //{name: 'lily',age: 18,hobby: '画画'}

二、JSONArray转成int数组

JSONArray jsonArray = JSONUtil.parseArray(deleteFileIds);
        if (jsonArray.size() == 0) {
            return new Responses(StatusCode.INPUT_ERROR, StatusMessage.PARAM_ERROR);
        }
        int[] deleteFileIdArray = new int[jsonArray.size()];
        for (int i = 0; i < jsonArray.size(); i++) {
            deleteFileIdArray[i] = (int) jsonArray.get(i);
        }