You can try filtering the JSON string using Newtonsoft.JSON
nuget package.
The JSON you provided is incomplete. I assume that this JSON string is an Object
and the outermost layer is {}
, then we can parse it like this
var obj = JObject.Parse(jsonString);
var c = obj["a"]["b"]["c"];
var myTransferModel = JsonConvert.DeserializeObject<MyModel>(c.ToString());
If the outermost layer is []
, please use JArray
for parsing.
Update
Refit
encapsulating the network request and JSON parsing. You can send a web request directly through HttpClient
to get a JSON string.
public async Task<string> GetJsonString(string url)
{
string result = string.Empty;
var client = new HttpClient();
var response = client.GetAsync(url);
if(response.IsSuccessStatusCode)
{
result = await response.Content.ReadAsStringAsync();
}
return result;
}
Best regards.