Object Diff

Determining the structural differences between objects

Algorithmia Platform License

Try the API

{
  "diff": [
    {
      "kind": "E",
      "lhs": "original name",
      "path": [
        "name"
      ],
      "rhs": "new name"
    },
    {
      "kind": "D",
      "lhs": "123-123-123",
      "path": [
        "phone"
      ]
    },
    {
      "kind": "E",
      "lhs": 3,
      "path": [
        "points",
        2
      ],
      "rhs": 5
    },
    {
      "index": 3,
      "item": {
        "kind": "N",
        "rhs": 6
      },
      "kind": "A",
      "path": [
        "points"
      ]
    },
    {
      "kind": "N",
      "path": [
        "note"
      ],
      "rhs": "new field"
    }
  ]
}

Install & Use

Use

curl -X POST -d '{
  "obj1": {
    "name": "original name",
    "age": 32,
    "phone": "123-123-123",
    "points": [1,2,3]
  }, 
  "obj2": {
    "name": "new name",
    "age": 32,
    "note": "new field",
    "points": [1,2,5,6]
  }
}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY' https://api.algorithmia.com/v1/algo/api2ninja/ObjectDiff/0.2.0