Answers for "create JSONObject from string java"

4

new jsonobject java

String message;
JSONObject json = new JSONObject();
json.put("name", "student");

JSONArray array = new JSONArray();
JSONObject item = new JSONObject();
item.put("information", "test");
item.put("id", 3);
item.put("name", "course1");
array.add(item);

json.put("course", array);

message = json.toString();

// message
// {"course":[{"id":3,"information":"test","name":"course1"}],"name":"student"}
Posted by: Guest on March-05-2020
0

create JSONObject from string java

String message;
JSONObject json = new JSONObject();
json.put(name, student);

JSONArray array = new JSONArray();
JSONObject item = new JSONObject();
item.put(information, test);
item.put(id, 3);
item.put(name, course1);
array.add(item);

json.put(course, array);

message = json.toString();

// message
// {course:[{id:3,information:test,name:course1}],name:student}
Posted by: xss on March-10-2022
0

create JSONObject from string java

String message;
JSONObject json = new JSONObject();
json.put(name, student);

JSONArray array = new JSONArray();
JSONObject item = new JSONObject();
item.put(information, test);
item.put(id, 3);
item.put(name, course1);
array.add(item);

json.put(course, array);

message = json.toString();

// message
// {course:[{id:3,information:test,name:course1}],name:student}
Posted by: Taylor Swift on March-10-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language