Any simple way to compare "actual" and "archived" JSON data?

I’m trying to build a “Notion updated DB item” polling solution. For that I save all DB records in a file, and after some period of time I read it and compare with actual data.

So I have two JSONs, I can match them by record IDs. All I need is to compare them, and in case of difference in any property, this record is considered as altered and triggers some action.

I managed to compare them by a SINGLE property (let’s say, Status). But I can’t figure out how to iterate over ALL properties while doing the stuff.

This is what I do for the SINGLE property:

  1. Add an “altered” boolean to the arcived data, false by default
  2. Change Status name of the arhived data to something else like Status_n8n
  3. Add these two columns to the actual data by merging it with the archived one
  4. Run the Function Item to check actual status against the archived one, and save true of false into the “altered” field
  5. Run some action on all the records which are “altered”

For comparing by a single prop, I don’t need the boolean column but it might be handy when comparing by all properties. If in some iteration I notice the difference, I can change the prop from false to true and that’s it for this record.

To iterate over ALL properties, I extract the schema from the Notion DB. Then I start the Split in batch, one by one, and try using it in renaming all the columns. But when I connect this structure to the previous solution, some wierd stuff appears like Property and Property_n8n are overlapping. And the whole loops breaks after the first run.

I guess my task is pretty common and all about comparing two JSON structures in terms of records. Would be grateful to any clue,

Instead of doing all that, which seems quite complex, I would probably add that event to the Notion Trigger. It was impossible when we created the trigger, but Notion has been updating the API regularly, meaning it might be possible today.


That would be really great and open doors to 2-side sync for all the Notion world. does have this trigger since summer.

I would speculate that if they have the trigger, then it’s possible to do it.

1 Like

I came up with a workaround based on my single prop solution. I introduce a “coding” column to the Notion DB, which concats all the columns I need. Thus I get a kind of coding sequence which is altered when any of the columns is altered. And my workflow checks this code updates.

Nevertheless, I’d gladly use a Notion trigger instead all of this.