Forums - C# Corner

Forum guidelines
tarun janveja

tarun janveja

  • 1.4k
  • 52
  • 2.2k

json array with json object

Aug 15 2017 1:00 AM
i have below json code i am getting error .input string not in correct format .i require below format .
{"msisdn": ["1234","5432"]} .please rectify my code where i am doing wrong
 
string data;
List<string> s = new List<string>();
s.Add("1234");
s.Add("5432");
JArray msisdn = new JArray();
msisdn.Add(s);
JObject o = new JObject();
o["msisdn"] = msisdn;
data = o["msisdn"];
Response.Write(data);   //error --input string is not in correct format

Answers (6)