Skip to contents

Compares RDS and JSON database files to verify migration accuracy and identify any differences in structure or content.

Usage

compare_rds_json(rds_path, json_path, ignore_meta = TRUE)

Arguments

rds_path

Path to RDS file

json_path

Path to JSON file

ignore_meta

Logical. Ignore metadata fields (those starting with underscore)? Default is TRUE.

Value

List of differences, each containing:

  • path: Location of difference in database structure

  • type: Type of difference (type_mismatch, missing_in_json, missing_in_rds, value_mismatch)

  • Additional fields depending on difference type

Details

This function performs a deep comparison of database structures, checking:

  • Data types match between formats

  • All keys/fields are present in both versions

  • Values are equivalent (accounting for format differences)

Useful for verifying that migration from RDS to JSON preserves all data and structure correctly.

Examples

if (FALSE) { # \dontrun{
# Compare original and migrated databases
differences <- compare_rds_json(
  "original/methods_db.rds",
  "migrated/methods_db.json"
)

if (length(differences) == 0) {
  message("Migration successful - databases are equivalent!")
} else {
  # Review differences
  for (diff in differences) {
    cat(sprintf("Difference at %s: %s\n", diff$path, diff$type))
  }
}
} # }