Fix handling of replacements in `DiffAsJSON`