© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
11 replies
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 ?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ What is the best way to learn c/c#?
C#CC# / help
3y ago
✅ What is the best way to store basic C#?
C#CC# / help
3y ago
✅ how to convert Dictionary to C# object?
C#CC# / help
2y ago
❔ Best way to learn C#?
C#CC# / help
3y ago