So, after searching a lot for a way to access JSON in C#, I found this way where I first store JSON data in a variable, then load that JSON into its class model.

The problem is that I have no single idea how to access the data (properties) in C#. If this were Javascript, I would access it by using indexers (but this doesn't work since it tells me that this type doesn't allow it) or by "." but that doesn't work either since it tells me that properties aren't defined in this context (even though they are defined in the class model).

I want to use the Pokemon API.

This is my class model (it was generated by VS) which is named PokemonData.cs:

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ServerExperiment
{
    class PokemonData
    {
        public class Rootobject
        {
            public List<Ability> abilities { get; set; }
            public int Base_experience { get; set; }
            public List<Form> forms { get; set; }
            public List<Game_Indices> game_indices { get; set; }
            public int height { get; set; }
            public List<Held_Items> held_items { get; set; }
            public int id { get; set; }
            public bool is_default { get; set; }
            public string location_area_encounters { get; set; }
            public List<Move> Moves { get; set; }
            public string name { get; set; }
            public int order { get; set; }
            public Species species { get; set; }
            public Sprites sprites { get; set; }
            public List<Stat> stats { get; set; }
            public List<Type> types { get; set; }
            public int weight { get; set; }
        }

        public class Species
        {
            public string name { get; set; }
            public string url { get; set; }
        }

        public class Sprites
        {
            public string back_default { get; set; }
            public object back_female { get; set; }
            public string back_shiny { get; set; }
            public object back_shiny_female { get; set; }
            public string front_default { get; set; }
            public object front_female { get; set; }
            public string front_shiny { get; set; }
            public object front_shiny_female { get; set; }
        }

        public class Ability
        {
            public Ability1 ability { get; set; }
            public bool is_hidden { get; set; }
            public int slot { get; set; }
        }

        public class Ability1
        {
            public string name { get; set; }
            public string url { get; set; }
        }

        public class Form
        {
            public string name { get; set; }
            public string url { get; set; }
        }

        public class Game_Indices
        {
            public int game_index { get; set; }
            public Version version { get; set; }
        }

        public class Version
        {
            public string name { get; set; }
            public string url { get; set; }
        }

        public class Held_Items
        {
            public Item item { get; set; }
            public Version_Details[] version_details { get; set; }
        }

        public class Item
        {
            public string name { get; set; }
            public string url { get; set; }
        }

        public class Version_Details
        {
            public int rarity { get; set; }
            public Version1 Version { get; set; }
        }

        public class Version1
        {
            public string Name { get; set; }
            public string Url { get; set; }
        }

        public class Move
        {
            public Move1 move { get; set; }
            public Version_Group_Details[] Version_group_details { get; set; }
        }

        public class Move1
        {
            public string Name { get; set; }
            public string Url { get; set; }
        }

        public class Version_Group_Details
        {
            public int Level_learned_at { get; set; }
            public Move_Learn_Method Move_learn_method { get; set; }
            public Version_Group Version_group { get; set; }
        }

        public class Move_Learn_Method
        {
            public string Name { get; set; }
            public string Url { get; set; }
        }

        public class Version_Group
        {
            public string Name { get; set; }
            public string Url { get; set; }
        }

        public class Stat
        {
            public int Base_stat { get; set; }
            public int Effort { get; set; }
            public Stat1 stat { get; set; }
        }

        public class Stat1
        {
            public string Name { get; set; }
            public string Url { get; set; }
        }

        public class Type
        {
            public int Slot { get; set; }
            public Type1 type { get; set; }
        }

        public class Type1
        {
            public string Name { get; set; }
            public string Url { get; set; }
        }
    }
}

```

And this is the Program.cs:

```
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ServerExperiment
{
    class Program
    {
        public static async void Main(string[] args)
        {
            PokemonData PokemonModel = new PokemonData();
            Uri Path = new Uri("https://pokeapi.co/api/v2/pokemon/ditto/");
            using (HttpClient Client = new HttpClient())
            {
                PokemonData PokemonInfo = await APIData(Client, Path);
                Console.WriteLine(PokemonInfo);
            }
        }
        public static async Task<PokemonData> APIData(HttpClient Client, Uri Address)
        {
            string JSONData = await Client.GetStringAsync(Address);
            PokemonData ReadyData = JsonConvert.DeserializeObject<PokemonData>(JSONData);
            return ReadyData;
        }
    }
}

```

As you can see, I want to print the height or weight or anything. But when I write `PokemonInfo.(something)` it tells me that it's undefined in this context, even though it's defined in the class.