Skip to content

[BUG]2.0.51反序列化JSON字符串报unclosed.str错误 #3219

@vangt703

Description

@vangt703

问题描述

1.2.83序列化$ref的字符串,用2.0.51进行反序列化时,报unclosed.str错误

环境信息

  • OS信息: windows
  • JDK信息:jdk 1.8.0_431
  • 版本信息:Fastjson2 2.0.51

重现步骤

Map<String, Object> innerMap = new HashMap<>();
innerMap.put("xxx", "xxxx");
innerMap.put("ttt", "tttt");
Map<String, Object> map = new LinkedHashMap<>();
map.put("key1~", innerMap);
map.put("key2", innerMap);

String JSONStr = com.alibaba.fastjson.JSON.toJSONString(map);
Map map2 = com.alibaba.fastjson2.JSON.parseObject(JSONStr, Map.class);

map2里的key2值不正确,为{"$ref":"$.key1~"}

期待的正确结果

期望map2里key2的值为 {"xxx":"xxxx","ttt":"tttt"}

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