В документации метода указано, что ответ будет:
Код: Выделить всё
{
:[{ /* driver ID */
"t":, /* time of binding/unbinding*/
"u": /* unit ID if binding, 0 if unbinding */
}],
...
}
I' Мы определили класс Response и его подкласс как:
Код: Выделить всё
public class GetDriverBindingsResponse : IWialonApiRequestObject
{
///
/// Collection of bindings. The key is a Driver Id
///
[JsonPropertyName("")]
public Dictionary? Bindings { get; set; }
}
public class DriverUnitBinding
{
///
/// time of binding/unbinding
///
[JsonPropertyName("t")]
public uint Time { get; set; }
///
/// unit ID if binding, 0 if unbinding
///
[JsonPropertyName("u")]
public long UnitId { get; set; }
}
Код: Выделить всё
string test = "{\"2534\":[{\"t\":1711353044,\"u\":10568}]}";
GetDriverBindingsResponse? x = JsonSerializer.Deserialize(test);
Console.WriteLine(x.Bindings?.Count);
Подробнее здесь: https://stackoverflow.com/questions/782 ... ialization