java实现两个JSON串合并

package com.toltech.springboot;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
 * @author Wgs
 * @version 1.0
 * @create:2017/10/31
public class jsonTest {
    @Test
    public void josn(){
        JSONObject jsonOne = new JSONObject();
        JSONObject jsonTwo = new JSONObject();
        jsonOne.put("name", "kewen");
        jsonOne.put("age", "24");
        jsonTwo.put("hobbit", "Dota");
        jsonTwo.put("hobbit2", "wow");
        JSONObject jsonThree = new JSONObject();
        jsonThree.putAll(jsonOne);
        jsonThree.putAll(jsonTwo);
        System.out.println(jsonThree.toString());