I have a dictionary with this format:
var dic = new Dictionary<string, string>(){
{"a.b.c", "value1"},
{"a.b.d", "value2"},
{"a.c.e", "value3"},
{"a.c.f", "value4"}
};
I want to achieve this json file format in C#.
{
"a":{
"b":{
"c":"value1",
"d":"value2"
},
"c":{
"e":"value3",
"f":"value4"
}
}
}
I used JsonConvert.SerializeObject(dic)
but the result is in this format:
{
"a.b.c":"value1",
"a.b.d":"value2",
"a.c.e":"value3",
"a.c.f":"value4"
}
I couldn't find a way to convert this format to the tree-based JSON format. Do you know any way that I can get it?