hi,
i am using below code for serializing jsn array but i getting error every time i.e Input string was not in a correct format. i need below json format .
{"id": ["99999", "8888","888881","6666","7777"]}
please help me .also let me know how to send this json request to user
code--
string Mnumber;
string data;
List<string> s = new List<string>();
// from data reader i m getting data from table
if (rdr.HasRows)
{
while (rdr.Read())
{
Mnumber = rdr[0].ToString();
if (Mnumber.Substring(0, 2) == "91" && Mnumber.Length == 12)
{
Mnumber = Mnumber.Remove(0, 2);
s.Add(Mnumber.ToString());
}
}
RootObject ar2 = new RootObject();
ar2.id = s;
data = JsonConvert.SerializeObject(ar2); //error line -- Input string was not in a correct format.
}
public class RootObject
{
public List<string> id { get; set; }
}