We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON.toJSONString
使用带 filter 参数的 JSON.toJSONString 方法,同时指定 Feature.ReferenceDetection Feature参数 转出的 json 自引用属性后面缺少冒号“:” ,格式错误
请填写以下信息:
见代码
Map<String, Object> map = new HashMap<>(); map.put("k", "v"); map.put("selfRef", map); // 无 filter 参数的 toJSONString String json = com.alibaba.fastjson2.JSON.toJSONString(map, Feature.ReferenceDetection); System.out.println(json); // 输出:{"selfRef":{"$ref":".."},"k":"v"} ,结果正确 PropertyPreFilter propertyJsonFilter = (serializer, source, property) -> true; // 带 filter 参数的 toJSONString String badJson = com.alibaba.fastjson2.JSON.toJSONString(map, propertyJsonFilter, Feature.ReferenceDetection); System.out.println(badJson); // 输出:{"selfRef"{"$ref":"$"},"k":"v"} ,自引用属性后面少了冒号“:”
输出自引用属性后不缺少冒号“:”的正确格式 json 字符串
The text was updated successfully, but these errors were encountered:
https://github.com/alibaba/fastjson2/releases/tag/2.0.52 问题已修复,请用新版本
Sorry, something went wrong.
yanxutao89
No branches or pull requests
问题描述
使用带 filter 参数的
JSON.toJSONString
方法,同时指定 Feature.ReferenceDetection Feature参数转出的 json 自引用属性后面缺少冒号“:” ,格式错误
环境信息
请填写以下信息:
重现步骤
见代码
JSON.toJSONString
方法,同时指定 Feature.ReferenceDetection Feature参数期待的正确结果
输出自引用属性后不缺少冒号“:”的正确格式 json 字符串
The text was updated successfully, but these errors were encountered: