---
category: reference
---

A JSONPatch object represents a compiled patch. The constructor takes a single argument giving the patch as an Array or as a String.

* patch - The patch document as a JS Array of operations or as a JSON String representing the same (the latter requires JSON support in your browser or the inclusion of the JSON2 library or similar)

Example:

    mypatch = new JSONPatch([{ "op": "replace", "path": "/baz", "value": "boo" }]);


Throws:

* InvalidPatch if the patch is invalid
