json-merge-patch

Implementation for Json Merge Patch based on RFC-7386

Лицензия

Лицензия

Категории

Категории

JSON Данные
Группа

Группа

com.hubbledouble
Идентификатор

Идентификатор

json-merge-patch
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

json-merge-patch
Implementation for Json Merge Patch based on RFC-7386
Ссылка на сайт

Ссылка на сайт

https://github.com/hubbledouble/json-merge-patch
Система контроля версий

Система контроля версий

http://github.com/hubbledouble/json-merge-patch

Скачать json-merge-patch

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.hubbledouble/json-merge-patch/ -->
<dependency>
    <groupId>com.hubbledouble</groupId>
    <artifactId>json-merge-patch</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.hubbledouble/json-merge-patch/
implementation 'com.hubbledouble:json-merge-patch:1.0.1'
// https://jarcasting.com/artifacts/com.hubbledouble/json-merge-patch/
implementation ("com.hubbledouble:json-merge-patch:1.0.1")
'com.hubbledouble:json-merge-patch:jar:1.0.1'
<dependency org="com.hubbledouble" name="json-merge-patch" rev="1.0.1">
  <artifact name="json-merge-patch" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.hubbledouble', module='json-merge-patch', version='1.0.1')
)
libraryDependencies += "com.hubbledouble" % "json-merge-patch" % "1.0.1"
[com.hubbledouble/json-merge-patch "1.0.1"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.fasterxml.jackson.core : jackson-databind jar 2.9.9
org.hibernate.validator : hibernate-validator jar 6.0.14.Final
org.glassfish : javax.el jar 3.0.1-b09

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Java JSON Merge patch implementation as per RFC-7386

Java specification implementation
The library provides a single point of entry for patching an object:
HTTPMethodProcessor#patch(String jsonRequest, T object) where "jsonRequest" is a partial json request and "object" is a the object to be patched.

Import the following library

   <dependency>
       <groupId>com.hubbledouble</groupId>
       <artifactId>json-merge-patch</artifactId>
       <version>1.0.1</version>
   </dependency>

Java usage example

 public T patch(String json, String pathParamId){
    T object = repository.findById(pathParamId);
    HTTPMethodProcessor.patch(json, object);
    repository.save(object);
 }

Data representation going through a merge patch update

Sample data (Original state)

  {
    "object"       : "object",
    "string"       : "value",
    "integer"      : 1,
    "child_object" : {
          "object"       : "other_object",
          "string"       : "other_value",
          "integer"      : 2
    }
  }

Sample patch request (only updating 2 fields of "child_object")

  {
    "child_object" : {
          "object"       : 5,
          "string"      : "updated_value"
    }
  }

Updated object (Only 2 fields were updated)

  {
    "object"       : "object",
    "string"       : "value",
    "integer"      : 1,
    "child_object" : {
          "object"       : 5,
          "string"       : "updated_value",
          "integer"      : 2
    }
  }

Версии библиотеки

Версия
1.0.1
1.0.0