Input string not in a correct format [closed]

Your problem is here:

int start = s.IndexOf("[[") + 2;
int end = s.IndexOf("]]", start);

You need to remove the " from there:

int start = s.IndexOf("[[\"") + 3;
int end = s.IndexOf("\"]]", start);

However, I strongly suggest you to use a JSON parser instead of this manual work.

Leave a Comment