Skip to content

Result of comparison depends on the order of datasets being compared #16

@fedorov

Description

@fedorov

This tool does not detect absolute difference between the 2 datasets.

Example:

1s.json:

{
    "Key1": "1"
}

2s.json:

{
    "Key1": "1",
    "Key2": "1"
}
$ python comparejson.py 2s.json 1s.json      
Reason: Length Mismatch: Expected Length: 2, Actual Length: 1
Expected:
  {
      "Key1": "1",
      "Key2": "2"
  }
Actual:
  {
      "Key1": "1"
  }
Missing keys: [u'Key2']
$ python comparejson.py 1s.json 2s.json
$

Is this a bug or an (undocumented) feature?

In comparison, jsondiff detects difference no matter what is the order:

$ jsondiff 1s.json 2s.json                                                                                               
{"Key2": "2"}%
$ jsondiff 2s.json 1s.json                                                                                               
{"$delete": ["Key2"]}%

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