为了账号安全,请及时绑定邮箱和手机立即绑定

在json中new String[]出现了乱码

Object  nullObj = null; 

private static void JSONObject() {

// TODO Auto-generated method stub

JSONObject wangxiaoer = new JSONObject();


wangxiaoer.put("name", "王小二");

wangxiaoer.put("age", 25.2);

wangxiaoer.put("birthday", "1990-01-01");

wangxiaoer.put("major" ,new String[]{"炒菜","挖掘机"});

wangxiaoer.put("car",nullObj);

wangxiaoer.put("house",nullObj);

System.out.println(wangxiaoer.toString());

}

}

得出来的结果是这样的

{"car":null,"birthday":"1990-01-01","age":25.2,"name":"王小二","house":null,"major":[Ljava.lang.String;@b166b5}



正在回答

1 回答


private static void JSONObject() {

Object  nullObj = null; 

JSONObject wangxiaoer = new JSONObject();


wangxiaoer.put("name", "王小二");

wangxiaoer.put("age", 25.2);

wangxiaoer.put("birthday", "1990-01-01");

wangxiaoer.put("major" ,new String[]{"炒菜","挖掘机"});

wangxiaoer.put("car",nullObj);

wangxiaoer.put("house",nullObj);

System.out.println(wangxiaoer.toString());

}

}


酱紫


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

在json中new String[]出现了乱码

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信