JSFiddle - React, Tailwind, and code Playground

by Martin Renvoize

HTML

<script src="https://rawgit.com/Starcounter-Jack/Fast-JSON-Patch/master/src/json-patch-duplex.js"></script>
No patch for creating an array before it's populated:
<div id="result"></div>

JavaScript

var obj1 = {
    "electronic": false,
    "frbr_id": null,
    "id": 29135,
    "in_stock": true,
    "metadata": {
        "collection-title": "Series title",
        "id": ["1-29135"],
        "title": "Journal test #3421",
        "type": "map"
    },
    "owner": "STAFFS",
    "owner_uuid": "1-29135"
};

var obj2 = {
    "electronic": false,
    "frbr_id": null,
    "id": 29135,
    "in_stock": true,
    "metadata": {
        "collection-title": "Series title",
        "id": ["1-29135"],
        "title": "Journal test #3421",
        "type": "book",
        "genre": [],
        "author": [],
        "editor": [],
        "collection-editor": [],
        "ISBN": ["6543654321"],
        "language": [],
        "note": [],
        "translator": []
    },
    "owner": "STAFFS",
    "owner_uuid": "1-29135",
    "status": {
        "invalid": [],
        "fixed": [],
        "removed": []
    }
};

var patches = jsonpatch.compare(obj1, obj2);

document.getElementById('result').innerText = JSON.stringify(patches);