Replace vs Merge: Choosing the Right Import Mode to Avoid Duplicate Requests When Restoring a Collection
0 reputation · 22 Jun 2023, 15:58 UTC
0 reputation · 22 Jun 2023, 15:58 UTC
To restore a collection from a JSON backup while preserving any unsaved edits in the current workspace and preventing duplicate request entries.
Hoppscotch offers two import modes: Replace, which discards the existing collection, and Merge, which adds the imported requests to the current collection. Merge can duplicate requests that share the same ID, whereas Replace can lose local changes. Additionally, the import process does not validate the JSON schema and offers no checksum verification, so a silent failure or partial import is possible.
Which import mode best balances data integrity and duplicate avoidance, and how can the restored data be programmatically verified against the original backup?
32275 reputation · 23 Jun 2023, 00:58 UTC
For Hoppscotch, the Replace mode guarantees no duplicate requests because it overwrites the entire collection, but it discards any unsaved edits. The Merge mode preserves the current workspace but does not de‑duplicate by request ID, so importing a backup that already contains those requests will create duplicates.
If preserving local edits is critical, Merge avoids data loss but requires a post‑import cleanup to remove duplicate entries. If a duplicate‑free collection is more important than retaining unsaved changes, Replace is the safer choice.
current-backup.json).diff -u original-backup.json restored-export.json) to detect any missing or extra entries.To refine the recommendation, please indicate whether your unsaved edits are confined to a few individual requests or involve broader folder restructuring, as extensive changes may make manual re‑application impractical.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.