README

Name

App::JSONDiff - Shows the differences in json files

image i_sparky_sparrowhub_io_badge_demanuel_app_jsondiff_foo_bar not found

Goal

To be able to quick see what's different between similar json files.

I had several k8s environments and i wanted to compare the configmaps. A diff falls short since it compares line by line and in a json file the order of the name/value pairs doesn't matter much.

Usage

with file1.json as:

{
  "name": "John Smith",
  "age": 30,
  "email": "[email protected]",
  "address": {
    "street": "123 Main St",
    "city": "Anytown",
    "state": "CA",
    "zip": "12345"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "555-1234"
    },
    {
      "type": "work",
      "number": "555-5678"
    }
  ],
  "isActive": true,
  "preferences": {
    "newsletter": true,
    "notifications": false
  }
}

with file2.json as:

{
  "name": "Jane Smith",
  "age": 28,
  "email": "[email protected]",
  "address": {
    "street": "456 Elm St",
    "city": "Anytown",
    "state": "CA",
    "zip": "12345"
  },
  "phoneNumbers": [
    {
      "type": "home",
      "number": "555-4321"
    },
    {
      "type": "work",
      "number": "555-8765"
    }
  ],
  "isActive": true,
  "preferences": {
    "newsletter": false,
    "notifications": true
  }
}

Invoke it:

$ jsondiff file1.json file2.json

Difference at age:
 30
 28

Difference at name:
 John Smith
 Jane Smith

Difference at address.street:
 123 Main St
 456 Elm St

Difference at preferences.newsletter:
 True
 False

Difference at preferences.notifications:
 False
 True

Difference at email:
 [email protected]
 [email protected]

Difference at phoneNumbers[0].number:
 555-1234
 555-4321

Difference at phoneNumbers[1].number:
 555-5678
 555-8765

License

This project is licensed under EUPL v1.2

Bugs

Plentiful! Report them in https://codeberg.org/demanuel/App-JSONDiff/issues or via email at [email protected]

App::JSONDiff v0.0.3

Shows the differences between json files

Authors

  • david santiago

License

EUPL-1.2

Dependencies

JSON::Fast

Test Dependencies

Provides

  • App::JSONDiff

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.