I have a text file that contains letters and numbers. This letter-number combination holds information about a user. For example: "P555636477JohnDoeEA 55687878 9789899 2899298" First letter can be either "P/G/S" meaning Premium, Gold or Simple. Follows his telephone number and name. Two letters E and A mean native language(English) and nationality (American). Then follows his other telephone numbers, that he has registered. There might be more than 3 numbers. My question is: what is the best method to parse this information into JSON object? Im thinking about using regex and StringBuilder, but Im not sure how to approach those telephone numbers at the end...
It should look something like this:
{ "membership": "Premium",
"telephone": "555636477",
"firstName": "John",
"lastName": "Doe",
"otherNumbers": [
{"number:"55687878"},
{"number":"9789899"},
{"number":"2899298"}
]
}