Json Compare avatar

Json Compare

Try for free

No credit card required

View all Actors
Json Compare

Json Compare

petr_cermak/json-compare
Try for free

No credit card required

Act for comparing 2 JSON arrays of objects. By default the final result set will contain only new and updated records.

act-json-compare

Apify act for comparing 2 JSON arrays of objects.

This act fetches JSON arrays from two urls ("old" and "new"), compares them and creates a new result set based on the act settings. By default the final result set will contain only new and updated records.

INPUT

Input is a JSON object with the following properties:

1{
2  "oldJson": OLD_JSON_URL,
3  "newJson": NEW_JSON_URL,
4  "idAttr": ID_ATTRIBUTE_NAME,
5  "return": WHICH_RECORDS_TO_RETURN,    // optional, default: "new, updated"
6  "addStatus": ADD_TEXT_STATUS          // optional, default: false
7  "statusAttr": STATUS_ATTR_NAME        // optional, default: "status"
8  "addChanges": ADD_CHANGE_INFO         // optional, default: false
9  "changesAttr": CHANGES_ATTR_NAME      // optional, default: "changes"
10  "updatedIf": [                        // optional, column list
11    "column_1",
12    "column_2",
13    ...
14  ]
15}

The idAttr parameter is a name of an attribute of each record, that will be used as it's ID.
The return parameter can be used to tell the act which records to include in the final result set. Possible values are new, updated, deleted and unchanged, you can provide more than one separated by comma.
The addStatus parameter sets if the act should add a status attribute to each of the resulting records.
If true, it's value will be one of NEW, UPDATED, DELETED or UNCHANGED, depending on the value of return parameter.
The addChanges parameter tells the act to include a list of columns that contained changes. This list will be added to a new changes column.
The changesAttr parameter overrides the default changes column name, where the changes will be stored.
The updatedIf parameter can contain an array of column names. If set, the record will be recognized as UPDATED if and only if there was a change in one of those columns. If addChanges is set to true, the changes array will contain the column names that had changes and are also present in the updatedIf array.

Developer
Maintained by Community

Actor Metrics

  • 1 monthly user

  • 1 star

  • Created in Nov 2017

  • Modified 2 years ago

Categories