0

I want to get some data properties located into this json object

Json output

I'am trying to retrieve this data into my model :

        string content = response.Content.ReadAsStringAsync().Result;
        dynamic result = JObject.Parse(content);

        IList<NasaAsteroid> nasaAsteroids = new List<NasaAsteroid>();

        int elementCount = result.element_count;
        string date = today.ToString("yyyy-MM-dd");

        for (int i = 0; i<= elementCount; i++)
        {
            NasaAsteroid nasaAsteroid = new NasaAsteroid
            {
                
                Id = result.near_earth_objects.date,
                //Name = result.near_earth_objects.today.ToString("yyyy/MM/dd").name,
                //Url = result.near_earth_objects.today.ToString("yyyy/MM/dd").nasa_jpl_url,
                //Magnitude = result.near_earth_objects.today.ToString("yyyy/MM/dd").absolute_magnitude_h,
            };
        }

For example In this case I want to get the name of the json object output (2020 MB1). Howewer How Do I get this property data ? The date : 2020-06-25 is dynamic in this case and when I try to get this property with some dynamic variable but it is not working.

What is the right way to do that?

guizmo
  • 95
  • 1
  • 10

0 Answers0