美文网首页
fastjson字符串转Map

fastjson字符串转Map

作者: timar | 来源:发表于2019-07-24 16:36 被阅读0次
            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
    

    相关文章

      网友评论

          本文标题:fastjson字符串转Map

          本文链接:https://www.haomeiwen.com/subject/pdxfrctx.html