Add JSON parsing and proper error handling for registration