HTTP request passes the difference between JSON and map.

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


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.