HI,
I have one joson object likr blelow
{ "Items":[{"Id":12,"Name":"s"},{"Id":23,"Name":"b"}] }
my requirement is that how to pass Id to method from Items Object
could you please help me
public void GetNumber(){ }
Hi mahesh213,
Refer below code.
public void GetNumber(int id) { } public class Details { public Item[] Items { get; set; } } public class Item { public int Id { get; set; } public string Name { get; set; } }
Then get it like below.
string json = "Your Json string"; Details detail = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<Details>(json); foreach (Item item in detail.Items) { GetNumber(item.Id); }
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.