fastjson中toString与toJSONString的差别

Posted 小破孩楼主

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了fastjson中toString与toJSONString的差别相关的知识,希望对你有一定的参考价值。

查看JSONObject源码:

 @Override
    public String toString() {
        return toJSONString();
    }

    public String toJSONString() {
        SerializeWriter out = new SerializeWriter();
        try {
            new JSONSerializer(out).write(this);
            return out.toString();
        } finally {
            out.close();
        }
    }

其实toString()方法内部还是调用了toJSONString()方法

以上是关于fastjson中toString与toJSONString的差别的主要内容,如果未能解决你的问题,请参考以下文章

fastjson使用JSON.toJSON()方法出现StackOverflowError

fastjson使用JSON.toJSON()方法出现StackOverflowError

fastjson使用JSON.toJSON()方法出现StackOverflowError

遍历HashMap是不是有序;以及fastJson.toJson()能否保证结果顺序一致

fastjson的基本用法,fastjson对日期的处理

Gson与FastJson比较