ashokp
❔ What is the Best Way to convert the nested C# object to key value pair
I want to store the C# objects in MongoDB which can be dynamic nature in key value fashion
like Attributes: [ { "key": "Name", "value": "Bob"}, {"key": "ID", "value": "123"..]
my C# Class is like this
public class Employee{
public string Name {get; set;}
public string ID {get;set;}
public Department Departments {get; set;}
}
public class Department{
public string Name {get; set;}
public string Description {get; set;}
}
How can I represent the nexted C# object to key value json ?
Any thoughts/suggestions ?
12 replies