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.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/rfc6902
    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/rfc6902

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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/rfc6902

      ATTENTION: ONLY! works for add/update/remove and does not work for JSONArrays yet

      Parameters:
      from - the original jsonobject
      patch - 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/rfc6902

      ATTENTION: ONLY! works for add/update/remove and does not work for JSONArrays yet

      Parameters:
      from - the original jsonobject
      to - the jsonobject we want to get to
      Returns:
      the patch as a JSONArray