Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想连接以下两个 json 对象。我怎样才能做到这一点?我的 json 对象如下:
"Object1": { "Stringkey":"StringVal", "ArrayKey": [Data0, Data1] } "Object2": { "Stringkey":"StringVal", "Stringkey":"StringVal", "Stringkey":"StringVal", }
JSONObject obj3 = (JSONObject) obj1.get("Object1"); JSONObject obj4 = (JSONObject) obj2.get("Object2"); JSONObject combined = new JSONObject(); combined.put("Object1", obj3); combined.put("Object2", obj4);