我正在尝试使用创建嵌套的 json 对象org.json.simple.JSONObject。为什么 jsonobject 改变顺序?
预期输出:
{
"id":"14",
"email":"xxx@gmail.com",
"Company":{
"address":"milton street",
"postal code":"cincinnati",
"name":"abc"
}
}
电流输出:
{
"Company":{
"address":"milton street",
"postal code":"cincinnati",
"name":"abc"
},
"id":"14",
"email":"xxx@gmail.com"
}
这是我的代码:
JSONObject First = new JSONObject();
First.put("id", "14");
First.put("email", "xxx@gmail.com");
JSONObject companydetails = new JSONObject();
companydetails.put("name", "abc");
companydetails.put("address", "milton street");
companydetails.put("postal code", "cincinnati");
First.put("Company",companydetails);
System.out.println(First.toString());
慕雪6442864
慕桂英3389331
繁星淼淼
缥缈止盈
相关分类