using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using Employee = Response.Employee;
using Car = Response.Car;
public static void Main()
Console.WriteLine("Hello World");
Response res = new Response { Dictionary = new Dictionary<Employee, List<Car>>()};
Employee firstEmployee = new Employee {Name = "John Doe", Id ="1111", Seniority = 2};
Employee secondEmployee = new Employee {Name = "Jane Doe", Id = "9999", Seniority = 10};
new Car {OwnerId = "1111", Model = "Chevrolet Spark", RegistrationPlate = "LTO1234"},
new Car {OwnerId = "1111", Model = "Chevrolet Malibu", RegistrationPlate = "LTO5678"}
new Car {OwnerId = "9999", Model = "Mercedes Benz", RegistrationPlate = "ABC1234"},
new Car {OwnerId = "9999", Model = "Mercedes Maybach", RegistrationPlate = "ABC5678"}
var result = JsonConvert.SerializeObject(res);
Console.WriteLine(result);
public Dictionary<Employee, List<Car>> Dictionary { get; set; }
public class Employee : TypeConverter
public string Name { get; set; }
public string Id { get; set; }
public decimal Seniority { get; set; }
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
if (sourceType == typeof(string))
return base.CanConvertFrom(context, sourceType);
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
if (destinationType == typeof(string))
return ((Employee)value).Name + "," + ((Employee)value).Id + "," + ((Employee)value).Seniority;
return base.ConvertTo(context, culture, value, destinationType);
public string OwnerId { get; set; }
public string Model { get; set; }
public string RegistrationPlate { get; set; }