The catch is to build the Key string as if it were a namespace. Doing this with recursion is my current implementation, but I'm sure there are more stack-friendly options (LINQ? Iterative?) which I have not yet been able to find. Almost every example is too simple and does not take into account the ability to "namespace" them based on key hierarchy.
Here is a quick example of the layout of my dictionary. Hopefully this is easy enough to understand - I wanted to be thorough.
I convert JSON similar to this (nested, to save data over the wire):
"entity": {
"foo": {
"bar": {
"baz": {
"2": "description",
"1": "title"
}
}
Into a Dictionary<string,object>. When Value is string, that's the end of the "namespace". A detailed, confusing look at this object:
[0] {[entity, Dictionary[String,Object]]} KeyValuePair<string,object>
Key "entity" string
Value Count = 1 object {Dictionary<string,object>}
[0] {[foo, Dictionary[String,Object]]} KeyValuePair<string,object>
Key "foo" string
Value Count = 12 object {Dictionary<string,object>}
[0] {[bar, Dictionary[String,Object]]} KeyValuePair<string,object>
Key "bar" string
Value Count = 1 object {Dictionary<string,object>}
[0] {[baz, Dictionary[String,Object]]} KeyValuePair<string,object>
Key "baz" string
Value Count = 3 object {Dictionary<string,object>}
[0] {[3, title]} KeyValuePair<string,object>
Key "3" string
Value "title" object {string}
This KeyValuePair would end up being: "entity.foo.bar.baz.title.3", "3"