TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
tarun janveja
NA
242
38.1k
json with jarray
Aug 8 2017 1:10 PM
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; }
}
Reply
Answers (
1
)
if column not exists from table A then select from tab B
visual studio 2015