“java jsonObject baru” Kode Jawaban

java jsonObject baru

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"}
2 Programmers 1 Bug

JSONObject Java

import org.json.simple.JSONObject;

class JsonEncodeDemo {

   public static void main(String[] args) {
      JSONObject obj = new JSONObject();

	    inputJSON.put("subscriberName", "subscriber");
	    inputJSON.put("msisdn","7055389495");

      System.out.print(obj);
   }
}
Outrageous Oryx

org.json.jsonobject ke objek java

JSONObject jsonObject = //...
JsonNode jsonNode = convertJsonFormat(jsonObject);
ObjectMapper mapper = new ObjectMapper();
MyPojoClass myPojo = mapper.readValue(new TreeTraversingParser(jsonNode), MyPojoClass.class);
Jittery Jellyfish

Jawaban yang mirip dengan “java jsonObject baru”

Pertanyaan yang mirip dengan “java jsonObject baru”

Lebih banyak jawaban terkait untuk “java jsonObject baru” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya