Package de.kosmos_lab.utils
Class JSONPatch
java.lang.Object
de.kosmos_lab.utils.JSONPatch
public class JSONPatch extends Object
-
Constructor Summary
Constructors Constructor Description JSONPatch() -
Method Summary
Modifier and Type Method Description static org.json.JSONObjectapply(org.json.JSONObject from, org.json.JSONArray patch)applies a very simple json-patch based on RFC 6902 https://tools.ietf.org/html/rfc6902static org.json.JSONArraygetPatch(org.json.JSONObject from, org.json.JSONObject to)create a very simple json-patch based on RFC 6902 https://tools.ietf.org/html/rfc6902
-
Constructor Details
-
JSONPatch
public JSONPatch()
-
-
Method Details
-
apply
public static org.json.JSONObject apply(org.json.JSONObject from, org.json.JSONArray patch)applies a very simple json-patch based on RFC 6902 https://tools.ietf.org/html/rfc6902ATTENTION: ONLY! works for add/update/remove and does not work for JSONArrays yet
- Parameters:
from- the original jsonobjectpatch- the patch to be applied- Returns:
-
getPatch
public static org.json.JSONArray getPatch(org.json.JSONObject from, org.json.JSONObject to)create a very simple json-patch based on RFC 6902 https://tools.ietf.org/html/rfc6902ATTENTION: ONLY! works for add/update/remove and does not work for JSONArrays yet
- Parameters:
from- the original jsonobjectto- the jsonobject we want to get to- Returns:
- the patch as a JSONArray
-