Started encrypt page

Created a page to encrypt an email. Right now it checks if a valid email is typed into the box and then makes a call to the server API to get a public key. Right now I'm having a hard time extracting the public key from the JSON. When I use a built in JSON parser it says that it's getting unexpected characters. Also, if I just print out the JSON, it looks something like this "--Begin public key---\n key \n --end public key--". Would it be possible to have the JSON just be {key:key} instead of having the boilerplate, "Begin public key" stuff?