アリfastJsonのいくつかのJson方式
6623 ワード
public class Main {
@Test
public void main() {
// write your code here
int sum=0;
for(int i=0;i<5;i++){
sum+=i;
}
System.out.print(sum);
}
public void JSONTest(){
String str="{\"errCode\":\"0\",\"id\":\"10\"}";
System.out.print(str);
}
@Test
public void setFastJson(){
JSONObject root =new JSONObject();//
root.put("errCode",1);
root.put("errMsg"," ");
JSONArray dateArr = new JSONArray();
JSONObject rootZhangchao = new JSONObject();
rootZhangchao.put("userName"," ");
rootZhangchao.put("position","java ");
rootZhangchao.put("webAddress","www.itmayiedu.com");
dateArr.add(rootZhangchao);
root.put("date",dateArr);
System.out.print(root.toJSONString());
}
@Test
public void mapJson(){
Map root = new HashMap<>();
root.put("errCode",1);
root.put("errMsg"," ");
List