diffj {mojson} | R Documentation |
Multiple JSON Objects Diff
Description
Find the difference between multiple JSON objects yielded by create, delete and update operations.
Usage
diffj(json_new, json_old, sep = "@", primary)
Arguments
json_new |
|
json_old |
|
sep |
|
primary |
|
Details
This function finds out the difference between two JSON lists. And the difference is as follows:
create
, stores the flattened result of objects only in thejson_new
, that is some JSON objects have been created.delete
, stores the flattened result of objects only in thejson_old
, that is some JSON objects have been deleted.change
, stores the value update information in the common objects, reflected by '+(add)', and '-(remove)' in thechng_type
field.
The change_summary
provides the general information of value change.
Value
list
. Contains the difference result, including path create, path delete and value change results.
Examples
library(mojson)
j1 <- list(list(x = 1, y = 2, b = list(m = 1, n = 1)),
list(x = 2, y = 2, b = list(m = 1, n = 1)))
j2 <- list(list(x = 2, y = 3, b = list(m = 1)),
list(x = 3, y = 2, b = list(m = 1, n = 1)))
diffj(j1, j2, primary = 'x')