Serialising sets and maps entries in deterministic way to avoid random
comparison failures.