how to use json array using for loop in c#
My code
for (int i = 0; i < child[0].roomlist.Count; i++)
{
var postdata = new
{
fromDate = fromdate,
toDate = todate,
hotelRequest = new
{
roomList = new[]
{
new { roomSeq = "54545", roomName = "A.c Room", tariffRequests = new[] { new { tarifSeq = "dfdf45b54", plan = "yu" } } },
new { roomSeq = "5454", roomName = "Del Room", tariffRequests = new[] { new { tarifSeq = "gdgfdg;l;gfd", plan = "Eu" } } },
new { roomSeq = "5422", roomName = "Suite Room", tariffRequests = new[] { new { tarifSeq = "fdght411", plan = "Euuu" } } },
new { roomSeq = "457", roomName = "Execu Room", tariffRequests = new[] { new { tarifSeq = "gfgfgf", plan = "tyt" } } },
new { roomSeq = "222", roomName = "NonRoom", tariffRequests = new[] { new { tarifSeq = "gfgfg", plan = "tyty" } } } }
},
datavisible = false
};
string requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(postdata);