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
1.1.46.sec01,key为数字类型时会作toString处理。所以 parse出来的对象要用字符串类型为key才能获取。但在1.2.41版本,key还是会保持数字类型,所以parse出来的对象要用Integer类型才能取得。 下面是DefaultJSONParser.java的源码贴图:
下面是测试用例:
`public class FastjsonTest {
public static void main(String[] args) { String text = "{123:\"abc\"}"; JSONObject obj = JSON.parseObject(text); int intKey = 123; String strKey = "123"; String intValue = (String) obj.get(intKey); String strValue = (String) obj.get(strKey); System.out.println("intKey: " + intKey + ", intValue: " + intValue); System.out.println("strKey: " + strKey + ", strValue: " + strValue); }
}`
The text was updated successfully, but these errors were encountered:
有点奇怪,按理key必须是string
Sorry, something went wrong.
add Feature.NonStringKeyAsString, for issue #1633
771e101
8e17752
https://github.com/alibaba/fastjson/releases/tag/1.2.42 新版已发布,请使用新版本。
No branches or pull requests
1.1.46.sec01,key为数字类型时会作toString处理。所以 parse出来的对象要用字符串类型为key才能获取。但在1.2.41版本,key还是会保持数字类型,所以parse出来的对象要用Integer类型才能取得。
下面是DefaultJSONParser.java的源码贴图:
下面是测试用例:
`public class FastjsonTest {
}`
The text was updated successfully, but these errors were encountered: