Skip to content

[BUG]JSONPath.set 在多层节点不存在时失效 #476

@cranone

Description

@cranone

问题描述

JSONPath.set 在多层节点不存在时失效

环境信息

  • 版本信息:[Fastjson2 2.0.7]

重现步骤

        JSONObject jsonObject=new JSONObject();
        jsonObject.put("c","c");
        JSONPath.set(jsonObject, "$.a.b", "123");
        System.out.println(jsonObject.toJSONString());

输出结果:{"c":"c"},在Fastjson 1.2.83中以上代码可以正确输出结果

期待的正确结果

{"a":{"b":"123"},"c":"c"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjsonpath

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions