Class JSONPatch


  • public class JSONPatch
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONPatch()  
    • Constructor Detail

      • JSONPatch

        public JSONPatch()
    • Method Detail

      • 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