Skip to content

Deletion of dictionary key not shown #87

@PhilippVWC

Description

@PhilippVWC

Hey. Thank you for your work on a handy cli tool to beautifully print json differences. It helps me a lot in my daily business.

Recently I discovered an unexpected behaviour.

The bash command line

jdiff -s explicit <(echo '{"a":1}') <(echo '{}')

outputs nothing.
I would expect it to yield

{"$delete": ["a"]}

The problem is caused by the following line:

if not (parsed_first and parsed_second):

The expression

not parsed_second

wrongly evaluates to true, since parsed_second is an empty dictionary.

I suggest you to change the line to

    if parsed_first is None and parsed_second is None:

Can you do that or do you want me to create a pull request?

Philipp

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