My code parses a JSON string into a JArray with 3 arrays. One is <string> machineName, the next is a List<string> emails, and the last is a List<string> phoneNumbers. However, when I parse the information and convert the JToken to a string using this:
JArray json = JArray.Parse(input);
var machineName = json[0];
var emailAddresses = json[1].ToString(0);
var phoneNumbers = json[2].ToString(0);
Both my emailAddresses and phoneNumbers look like,
"[\"example@gmail.com\"]"
in the debugger/watches
while I want them to look like
"example@gmail.com"
Ideally, this is what I want the "emailAddresses" string to look like:
example1@gmail.com, example2@gmail.com, example3@gmail.com, example4@gmail.com
What I have tried:
I've tried
var emails = JsonConvert.DeserializeObject(emailAddresses);
var phones= JsonConvert.DeserializeObject(phoneNumbers);
And it formats it correctly, however they are still objects and I need them to be a list of correctly formatted strings.