fix serialization for strings and keys to use same escape logic (there were two code paths)