0
Rajeev it will be very specific ,it works for static keys.but if i got more than 2 matching values from my database as per the query .than what should i do.i think jarray works for me.but i am unable to do the same.please help me. i have save result from my query using dataready in one variable i.e data field.but how should i put result in jarray and give final output
data =qi,q3,123,q4,.............
final output = {"id":["qi","q3","123","q4",...]}
0
Hi Tarun,
Please try the below code.
- using System;
- using System.Collections.Generic;
- using Newtonsoft.Json;
-
- public class Program
- {
- public static void Main()
- {
- RootObject r=new RootObject();
- List<string> s=new List<string>();
- s.Add("q1") ;
-
- s.Add("q2") ;
- r.id=s;
-
-
- string output = JsonConvert.SerializeObject(r);
-
-
- Console.WriteLine(output);
- }
-
-
- }
- public class RootObject
- {
- public List<string> id { get; set; }
- }