Skip to content

when compare two json field about null and empty string "", the zjsonpatch is unexcept #202

@shengqianfeng

Description

@shengqianfeng

`

    final String newData = "{}";

    final String oldData = "{\"x\": \"\"}";

   JsonNode oldJson = OBJECT_MAPPER.readTree(StringUtils.isEmpty(oldData) ? "{}" : oldData);

    JsonNode newJson = OBJECT_MAPPER.readTree(StringUtils.isEmpty(newData) ? "{}" : newData);

     final EnumSet<DiffFlags> enumSet = EnumSet.of(DiffFlags.ADD_ORIGINAL_VALUE_ON_REPLACE);

     JsonNode jsonNode = JsonDiff.asJson(oldJson, newJson, enumSet);

`
the op filed of result is: remove ----this is right.
the value filed of result is: "" -----this is not right , i think the right value is null. beacuse the "value" of result should represent new value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions