Вот пример с использованием
System.Text.Json
public class AccountType {
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("title")]
public string Title { get; set; }
}
public class Balance {
[JsonPropertyName("amount")]
public decimal Amount { get; set; }
[JsonPropertyName("currency")]
public int Currency { get; set; }
}
public class Account {
[JsonPropertyName("alias")]
public string Alias { get; set; }
[JsonPropertyName("fsAlias")]
public string FsAlias { get; set; }
[JsonPropertyName("bankAlias")]
public string BankAlias { get; set; }
[JsonPropertyName("title")]
public string Title { get; set; }
[JsonPropertyName("type")]
public AccountType Type { get; set; }
[JsonPropertyName("hasBalance")]
public bool HasBalance { get; set; }
[JsonPropertyName("balance")]
public Balance Balance { get; set; }
[JsonPropertyName("currency")]
public int Currency { get; set; }
}
public class AccountsInfo {
[JsonPropertyName("accounts")]
public Account[] Accounts { get; set; }
}
Потом
var data = JsonSerializer.Deserialize<AccountsInfo>(json);
data.Accounts[0].Balance.Amount; //баланс первого счёта
генерил классы тут:
https://json2csharp.com/