Currently the function returns plain text rather than json if a user registration fails.
Currently the function returns plain text rather than json if a user registration fails.