.net HttpClient with custom JsonConverter

前端 未结 3 895
离开以前
离开以前 2020-12-16 14:14

I\'m using .NET\'s HttpClient to make requests to a WebAPI that returns some JSON data that requires a little bit of custom deserialization on the client\'s side. For this

3条回答
  •  清酒与你
    2020-12-16 14:52

    May be you would like to use HttpClient.GetStringAsync Method (String)

    var response = client.GetStringAsync("api/sites/" + sid);
    return JsonConvert.DeserializeObject(response.Result, new  PrefClassJsonConverter());
    

    Or what exactly you want to be more elegant?

提交回复
热议问题