HTTP request passes the difference between JSON and map.

lyfGeek 2022-05-22 11:59:13 阅读数:70

httprequestpassesdifferencejson

http Request delivery Json and Map The difference between .

 public static void main(String[] args) {

Map map = new HashMap<>();
map.put("name", "ceshi");
map.put("password", "123456");
System.out.println(map.toString()); // {name=ceshi, password=123456}
System.out.println(JSON.toJSONString(map)); // {"name":"ceshi","password":"123456"}
JSONObject json = new JSONObject();
json.put("name", "ceshi");
json.put("password", "123456");
System.out.println(json.toJSONString()); // {"password":"123456","name":"ceshi"}
}
copyright:author[lyfGeek],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/142/202203140552359828.html