Escape the contents of object keys when writing JSON