Pulling rest api, I get an array of objects each of which has a property-array filters

"filters": [ { "filterType": "PRICE_FILTER", "minPrice":"0.01000000", "maxPrice":"10000000.00000000", "tickSize":"0.01000000" }, { "filterType":"LOT_SIZE", "minQty":"0.00001000", "maxQty":"10000000.00000000", "stepSize":"0.00001000" }, { "filterType":"MIN_NOTIONAL", "minNotional":"10.00000000" } ] 

Is it even possible to make deserialization into classes, and is it possible to bring all these properties to a class one level higher instead of filters themselves. For parsing I use JObject.Parse (string)

  public class ExchangeInfo { [JsonProperty("timezone")] public string Timezone { get; set; } [JsonProperty("serverTime")] public long ServerTime { get; set; } [JsonProperty("rateLimits")] public IEnumerable<LimitInfo> Limits { get; set; } [JsonProperty("symbols")] public IEnumerable<SymbolInfo> Symbols { get; set; } } public class LimitInfo { [JsonProperty("rateLimitType")] public string RateLimitType { get; set; } // REQUESTS [JsonProperty("interval")] public string Interval { get; set; } // MINUTE, SECOND, DAY [JsonProperty("limit")] public int Limit { get; set; } } public class SymbolInfo { [JsonProperty("symbol")] public string Symbol { get; set; } [JsonProperty("status")] public string Status { get; set; } [JsonProperty("baseAsset")] public string BaseAsset { get; set; } [JsonProperty("baseAssetPrecision")] public int BaseAssetPrecision { get; set; } [JsonProperty("quoteAsset")] public string QuoteAsset { get; set; } [JsonProperty("quotePrecision")] public int QuotePrecision { get; set; } [JsonProperty("orderTypes")] public IEnumerable<string> OrderTypes { get; set; } [JsonProperty("icebergAllowed")] public bool IcebergAllowed { get; set; } // Что должно быть здесь? [JsonProperty("filters")] public IEnumerable<string> Filters { get; set; } } 

Link to api https://www.binance.com/api/v1/exchangeInfo I need the SymbolInfo object to correctly fill the Filters property

Closed due to the fact that the essence of the issue is incomprehensible by the participants tym32167 , MihailPw , nörbörnën , 0xdb , PashaPash Jun 3 '18 at 19:12 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • And why is it not standard? - EvgeniyZ
  • five
  • @EvgeniyZ, in an array of objects of different types, will work normally? I myself can not check. - Andrey NOP
  • @AndrewNOP Yes, everything should be quite normal. - EvgeniyZ
  • one
    @MaxBurtsev I told you the exact answer of how to deserialize JSON. Look at its structure more closely, you can use third-party tools . What are Filters? This is a kind of array, each object contains other objects. So create a Filter class and stick all internal objects there, and where you ask, specify list<Filter> Filters . By the way, json.net no matter which letter indicates the property in the class, so all your JsonProperty is superfluous (unless the name itself is of course different). - EvgeniyZ

1 answer 1

Since your filters have properties with different names and it doesn’t matter that they cannot be accessed by name, but only by key, you can create an array of dictionaries.

 public class SymbolInfo { ... public IEnumerable<Dictionary<string,string>> Filters { get; set; } }