@Ahmed Abdo , Welcome to Microsoft Q&A, based on my test, I find that your json file has the problem. Please delete the comment // This value in your json file.
Then, you could try the following code to access the value by using class object.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var myJsonResponse = File.ReadAllText(@"C:\Users\username\Desktop\2.txt");
dynamic myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
textBox1.Text = myDeserializedClass.items[9].value[0][0].id_form_item;
}
}
public class Item
{
public int id_form_item { get; set; }
public string item_type { get; set; }
public object value { get; set; }
}
public class Root
{
public string id { get; set; }
public string id_form { get; set; }
public string name { get; set; }
public string id_creator { get; set; }
public DateTime creation_date { get; set; }
public DateTime modification_date { get; set; }
public List<Item> items { get; set; }
}
Result:
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.