fastjson字符串转Map

2019-07-24  本文已影响0人  timar
        JSONObject json = new JSONObject();
        json.put("name", "jacky");
        json.put("age", 23);
        json.put("time", System.currentTimeMillis());
        String string = json.toString();
        System.out.println(string);
        Map<String, String> map = JSON.parseObject(string, new TypeReference<Map<String, String>>(){});
        System.out.println(map);


{"name":"jacky","time":1563957295755,"age":23}
{name=jacky, time=1563957295755, age=23}

int和long都会转为String
上一篇下一篇

猜你喜欢

热点阅读