public void ParseWeightData(string rawContent) { var weightJsonArray = JObject.Parse(rawContent)["weight"].ToArray(); foreach (var weightJson in weightJsonArray) { var weight = new FitbitWeightResult(); weight.Weight = weightJson["weight"]?.Value <decimal>() ?? 0; weight.Date = weightJson["date"].Value <DateTime>(); WeightResultList.Add(weight); } }
public void ParseWeightData(string rawContent) { var weightJsonArray = JObject.Parse(rawContent)["weight"].ToArray(); foreach (var weightJson in weightJsonArray) { var weight = new FitbitWeightResult(); weight.Weight = weightJson["weight"]?.Value<decimal>() ?? 0; weight.Date = weightJson["date"].Value<DateTime>(); WeightResultList.Add(weight); } }