Link to home
Start Free TrialLog in
Avatar of IzzyTwinkly
IzzyTwinklyFlag for United States of America

asked on

Parsing Json string with

Hi guys,

I have the following Json string:

I create Employee class as follow:
public class Employee
        public KeyValuePair<string, string>[] Properties { get; set; }

And I called
Employee[] employees = JsonConvert.DeserializeObject<Employee[]>(JsonString);

Since I want it to be printed as
EmployeeType: Full
ID: 123456

so I used the following code:
foreach (var eID in employees)
                 foreach (var item in eID.Properties)
                     Console.WriteLine("{0}: {1}", item.Key, item.Value);

However, I am getting "NullReferenceException was unhandled" exception on foreach line.

Can anybody let me know how I can fix this issue?

Avatar of kaufmed
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IzzyTwinkly


Thank you so much,  käµfm³d!
I really appreciate your help all the time.
NP. Glad to help  = )