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

list. The new JSON objects.

json_old

list. The old JSON objects.

sep

character. A character/string used to separate keys in the nesting path. Defaults to @ to avoid the occasional overriding. Not recommended to use some risky characters like . and \. When compact = FALSE, it is unnecessary to assign sep explicitly, unless @ has been used in the keys.

primary

character. The primary path(keys) for identifying a unique JSON object. The value provided should contain the sep value to specify the nesting information unless it is an outermost key.

Details

This function finds out the difference between two JSON lists. And the difference is as follows:

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')

[Package mojson version 0.1 Index]