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
将 Map<Integer,String> 对象 转为JSON字符串后,调用 JSON.isValid() 方法显示 false
Map<Integer,String>
JSON.isValid()
请填写以下信息:
public static void main(String[] args) { Map<Integer, String> map = new HashMap<>(); map.put(1, "1"); map.put(2, "2"); String jsonStr = JSON.toJSONString(map); System.out.println(jsonStr); // {1:"1",2:"2"} System.out.println(JSON.isValid(jsonStr)); // false }
JSON.isValid(jsonStr) 为 true
无
The text was updated successfully, but these errors were encountered:
应该是要使用 WriteNonStringKeyAsString String jsonStr = JSON.toJSONString(map, JSONWriter.Feature.WriteNonStringKeyAsString);
String jsonStr = JSON.toJSONString(map, JSONWriter.Feature.WriteNonStringKeyAsString);
Sorry, something went wrong.
这种不是json.org规范中支持的,返回false不能说是错误啊
No branches or pull requests
问题描述
将
Map<Integer,String>
对象 转为JSON字符串后,调用JSON.isValid()
方法显示 false环境信息
请填写以下信息:
重现步骤
期待的正确结果
JSON.isValid(jsonStr) 为 true
相关日志输出
无
附加信息
无
The text was updated successfully, but these errors were encountered: