JSON ARRAY TO LIST TO GRIDVIEW

Loop through a JSON array to put into a list so that I can use the list in a grid. Here is what I have thus far. I'm using C# and needing to get all information at index 0 and put that in a grid row, then index 1, index 2 and so forth. I have some code as shown below and have also attached the JSON file for reference.

protected void GetNPInformation()
        {
            string searchUrl = "https://npiregistry.cms.hhs.gov/api/resultsDemo2/";
            string searchCritera = "?city=baltimore";
            //string returnFileFormat = "&rt=json";


            string fullSearchPath = searchUrl + searchCritera;

            //Get search results back in JSON format.
            string jsonData = new WebClient().DownloadString(fullSearchPath);
            
           
            //Read all items
            var path = Server.MapPath(@"~/json-test.json");
            var root = JsonConvert.DeserializeObject<RootObject>(jsonData);
            var taxonomies = root.results[0].taxonomies;
            var basic = root.results[0].basic;
            var address = root.results[0].addresses;
            

        }

        public class Taxonomy
        {
            public string state { get; set; }
            public string code { get; set; }
            public bool primary { get; set; }
            public string license { get; set; }
            public string desc { get; set; }
        }

        public class Address
        {
            public string city { get; set; }
            public string address_2 { get; set; }
            public string telephone_number { get; set; }
            public string fax_number { get; set; }
            public string state { get; set; }
            public string postal_code { get; set; }
            public string address_1 { get; set; }
            public string country_code { get; set; }
            public string country_name { get; set; }
            public string address_type { get; set; }
            public string address_purpose { get; set; }
        }

        public class Basic
        {
            public string status { get; set; }
            public string credential { get; set; }
            public string first_name { get; set; }
            public string last_name { get; set; }
            public string middle_name { get; set; }
            public string name { get; set; }
            public string sole_proprietor { get; set; }
            public string gender { get; set; }
            public string last_updated { get; set; }
            public string name_prefix { get; set; }
            public string enumeration_date { get; set; }
            public string authorized_official_telephone_number { get; set; }
            public string parent_organization_legal_business_name { get; set; }
            public string authorized_official_middle_name { get; set; }
            public string authorized_official_last_name { get; set; }
            public string organization_name { get; set; }
            public string organizational_subpart { get; set; }
            public string authorized_official_title_or_position { get; set; }
            public string parent_organization_ein { get; set; }
            public string authorized_official_first_name { get; set; }
        }

        public class Result
        {
            public List<Taxonomy> taxonomies { get; set; }
            public List<Address> addresses { get; set; }
            public int created_epoch { get; set; }
            public List<object> identifiers { get; set; }
            public List<object> other_names { get; set; }
            public int number { get; set; }
            public int last_updated_epoch { get; set; }
            public Basic basic { get; set; }
            public string enumeration_type { get; set; }
        }

        public class RootObject
        {
            public int result_count { get; set; }
            public List<Result> results { get; set; }
        }

    }
}

Open in new window

Trent AdamsApplication EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Trent

I'm afraid there's no attachment.
0
Trent AdamsApplication EngineerAuthor Commented:
I'm not sure why the attachment didn't attach. However, I think I'm closing the question as I should be able to use the JSON file as is.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Trent AdamsApplication EngineerAuthor Commented:
The more research that I did regarding this file showed that I shouldn't have to perform additional tasks to utilize the JSON file. By taking the the JSON data and putting into another list is counter productive and would create unnecessary code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.