using System;
using System.Text.Json;
using System.Collections.Generic;
public class MyData
{
public int Order { get; set; }
public int Equation { get; set; }
public string Value { get; set; }
public object ValueTo { get; set; }
public string Sign { get; set; }
public bool IsDefault { get; set; }
public string Color { get; set; }
public bool IsBlink { get; set; }
}
public class Program
{
public static void Main()
{
string jsonString = "[{\"order\":1,\"equation\":1,\"value\":\"Да\",\"valueTo\":null,\"sign\":\"fas fa-clock\",\"isDefault\":false,\"color\":\"#000000\",\"isBlink\":false},{\"order\":2,\"equation\":1,\"value\":\"true\",\"valueTo\":null,\"sign\":\"fas fa-clock\",\"isDefault\":false,\"color\":\"#000000\",\"isBlink\":false}]";
List<MyData> myDataList = JsonSerializer.Deserialize<List<MyData>>(jsonString);
foreach (var data in myDataList)
{
Console.WriteLine($"Order: {data.Order}, Value: {data.Value}");
}
}
}
In this code snippet, we define a class MyData with properties matching the JSON object structure. We then use JsonSerializer.Deserialize method to convert the JSON string into a list of MyData objects. Finally, we iterate over the deserialized list to access and print the values of each object.