I have this string that I get from an outside data source. It looks like this:
var myString = "Worker Management System :
Your request has been submitted
________________________________________
Your Account User Info:
Name : Doe, John, A
ID : JDOE123
Email :
Title : Worker
BusinessUnit : BARN
Department : PIGS
EmployeeID :
SupervisorName : Doe, Jane, B
HireDate : 02/22/2002
Role : Feed Pigs;
ManagerEmail : JaneDoe@mail.com
City : New York
State : NY
ZipCode : 12345
Phone : --
"
I'd like to parse this into a JSON (or something that i can work with) so that I can call maybe myString.Name and have it return Doe, John, A.
Is this possible? It's not an option for my to modify the way I get this string, I'm just trying to format it so I can easily extract the data from it.
I've looked into Douglas Crockford's JSON.parse
, but that doesn't do me any good if my string isn't already properly formatted.