Register member documentation not clear

The code expects the custom field to be formatted as a string, however it looks like you are trying to pass it as a JSON object. You can just call JSON.stringify on the value. When accessing it later you can call JSON.parse to convert it back to the expected value.