Looking for java Keywords? Try Ask4Keywords

Java Language JSON Builder - методы цепочки


пример

Вы можете использовать цепочку методов при работе с JSONObject и JSONArray .

Пример JSONObject

JSONObject obj = new JSONObject();//Initialize an empty JSON object 
//Before: {}
obj.put("name","Nikita").put("age","30").put("isMarried","true");
//After: {"name":"Nikita","age":30,"isMarried":true}

JSONArray

JSONArray arr = new JSONArray();//Initialize an empty array
//Before: []
arr.put("Stack").put("Over").put("Flow");
//After: ["Stack","Over","Flow"]