More general compare functionality, JSON storage.