Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JSONObject json = new JSONObject();
- try {
- json.put("CustomerID", "069C21F1-EE87-4FB4-A129-478AEAA454FF");
- json.put("Name", "Name_" + (int) Math.random() * 1000);
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- 1. prepare a LinkedHashMap object with elements
- 2. convert it to JSONObject
- Map obj = new LinkedHashMap();
- obj.put("a", "String1");
- obj.put("b", new Integer(1));
- obj.put("c", new Boolean(true));
- obj.put("d", "String2");
- JSONObject json = new JSONObject(obj);
- public JSONObject(Map map)
Add Comment
Please, Sign In to add comment