You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's hard to understand your question because it is not very clear what exactly you want to do. Do the JSON objects come from different files? From another JSON object? Do you want to remove both duplicates or keep one? Do you prefer keeping the id from the first object over the second object, or viceversa, or does it not matter?
Also because your example is not valid JSON (], [), and in one object the expiration days are a "180" string and in the other a 180 numbers, etc.
Anyway, comparing objects ignoring the value of ID is pretty straight forward, you can use a combination of the del/1 function and the unique_by/1 function to do this.
For example, if you have multiple files containing those objects with just a Rules entry and nothing else, and you want to output, a single object with a Rules entry that contains the union of all the Rules, and you don't care about the order of the rules in the output, and if there are duplicates ignoring ID you want to keep only one duplicate (not preferring the ID from a file over another), you would just use:
Hi,
I have a weird mere issue. I want to merge 2 json's equal objects disregarding the
ID
keyThe text was updated successfully, but these errors were encountered: