Skip to content

新版本不支持下划线转驼峰对象key-json(大小写)反序列化了?[BUG] #1615

@mystox

Description

@mystox

问题描述

简要描述您碰到的问题。
json报文中包含下划线(包括大小写)的反序列化问题

环境信息

请填写以下信息:

  • OS信息: [e.g.:CentOS 8.4.2105 4Core 3.10GHz 16 GB]
  • JDK信息: [e.g.:Openjdk 1.8.0_312]
  • 版本信息:[e.g.:Fastjson2 2.0.34]

重现步骤

如何操作可以重现该问题:

main{
        JSONObject test = new JSONObject();
        test.put("live_url", "123");
        //test.puT("LIVE_URL", "123")
        CameraVO cameraVO = test.toJavaObject(CameraVO.class);
        System.out.println(cameraVO);
}

public class CameraVO extends EquipmentVO {
    private String liveUrl;
    private String replayUrl;

    public String getReplayUrl() {
        return replayUrl;
    }

    public void setReplayUrl(String replayUrl) {
        this.replayUrl = replayUrl;
    }

    public String getLiveUrl() {
        return liveUrl;
    }

    public void setLiveUrl(String liveUrl) {
        this.liveUrl = liveUrl;
    }

期待的正确结果

能够正常反序列化成功

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions