Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect diff for a string #32

Open
eralumin opened this issue Feb 4, 2020 · 1 comment
Open

Incorrect diff for a string #32

eralumin opened this issue Feb 4, 2020 · 1 comment

Comments

@eralumin
Copy link

eralumin commented Feb 4, 2020

Hi, i've got two json files:

old.json

{
  "network": {
    "domain": "old.domain"
  }
}

new.json

{
  "network": {
    "domain": "new.domain"
  }
}

When i run:

jsondiff.diff(old_json, new_json, syntax="symmetric")

I've got this:

{
    "network": {
        "domain": [
            "old.domain",
            "new.domain"
        ]
    }
}

Instead of:

{
    "network": {
        "domain": {
            "$delete": [ "old.domain" ],
            "$insert": [ "new.domain" ]
        }
    }
}

The json expected that I've written is probably not right, it's just an example to show the diff keys I expect.

It is normal behavior? Did I forget something?

@mic-max
Copy link

mic-max commented Apr 3, 2020

Definitely looks like a bug.
I reproduced it with the CLI tool and it works for non-symmetric:

> jsondiff old.json new.json -i 2
{
  "network": {
    "domain": "new.domain"
  }
}
> jsondiff old.json new.json -i 2 -s symmetric
{
  "network": {
    "domain": [
      "old.domain",
      "new.domain"
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants