private static void createJsonByBean(){
Diaosi wangxiaoer = new Diaosi();
wangxiaoer.setName("王小二");
wangxiaoer.setAge(25.2);
wangxiaoer.setBirthday("1990-01-01");
wangxiaoer.setSchool("蓝翔");
wangxiaoer.setMajor(new String[]{"1","1"});
wangxiaoer.setHas_girlfriend(false);
wangxiaoer.setCar(null);
wangxiaoer.setHouse(null);
wangxiaoer.setComment("这是一个注释");
System.out.println(new JSONObject(wangxiaoer));
}
控制台输出
{"birthday":"1990-01-01","major":[{"bytes":[{}],"empty":false},{"bytes":[{}],"empty":false}],"school":"蓝翔","car":null,"name":"王小二","has_girlfriend":false,"comment":"这是一个注释","house":null,"age":25.2}
问题是字符串数组major没有输出字符串,输出的bytes类型的字节码,希望知道的回复一下