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
我的类中有一些字段是由一个英文字母和另一个单词组成,按照标准驼峰命名 例如:vSpeed 当我使用JSON.parseObject方法将json字符串中该字段反序列到实体类时,总是不能成功将值映射到实体类中
请填写以下信息:
1、新建一个类,添加由一个英文字母和另一个单词组成的实体类字段,eg: xSpeed 2、准备对应该实体类字段的json字符串,eg: {"xSpeed":999.999} 3、使用JSON.parseObjec()方法反序列化该json字符串到实体类中,然后输出该实体类的字段发现没有成功赋值 实例代码如下: public static void main(String[] args) throws Exception{ String json = "{"xSpeed":20.7,"aName":"bug"}"; Test t = JSON.parseObject(json, Test.class); System.out.println(t.getXSpeed()); System.out.println(t.getAName()); }
static class Test{ private float xSpeed; private String aName; public float getXSpeed() { return xSpeed; } public void setXSpeed(float xSpeed) { this.xSpeed = xSpeed; } public String getAName() { return aName; } public void setAName(String aName) { this.aName = aName; } }
能够正常将字段值设置到实体类中
请复制并粘贴任何相关的日志输出。
The text was updated successfully, but these errors were encountered:
https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.13-SNAPSHOT/ 问题已经修复,请用2.0.13-SNAPSHOT版本帮忙验证,2.0.13版本预计9月12日发布
Sorry, something went wrong.
https://github.com/alibaba/fastjson2/releases/tag/2.0.13 2.0.13版本已经发布,请用帮忙用新版本验证
No branches or pull requests
问题描述
我的类中有一些字段是由一个英文字母和另一个单词组成,按照标准驼峰命名
例如:vSpeed
当我使用JSON.parseObject方法将json字符串中该字段反序列到实体类时,总是不能成功将值映射到实体类中
环境信息
请填写以下信息:
重现步骤
1、新建一个类,添加由一个英文字母和另一个单词组成的实体类字段,eg: xSpeed
2、准备对应该实体类字段的json字符串,eg: {"xSpeed":999.999}
3、使用JSON.parseObjec()方法反序列化该json字符串到实体类中,然后输出该实体类的字段发现没有成功赋值
实例代码如下:
public static void main(String[] args) throws Exception{
String json = "{"xSpeed":20.7,"aName":"bug"}";
Test t = JSON.parseObject(json, Test.class);
System.out.println(t.getXSpeed());
System.out.println(t.getAName());
}
期待的正确结果
能够正常将字段值设置到实体类中
相关日志输出
请复制并粘贴任何相关的日志输出。
附加信息
The text was updated successfully, but these errors were encountered: