JSON Patch: implement and test the replace operation