现在已经实现树的广度优先遍历,知道文件在树中的深度及文件的一切信息,如何把这个文件树变成对象或json?
Dictionary<string, List<Dictionary<string, List<Dictionary<string, string>>>>>
//例如字典和列表的泛型对象
//又或者类的实例对象
图片这种的文件结构转化成以下的json
{
"Name":"a.name",
"Path":"a.path",
"Children":[
{
"Name":"b.name",
"Path":"b.path",
"Children":[
{
"Name":"d.name",
"Path":"d.path"
},
{
"Name":"e.name",
"Path":"e.path"
}
]
},
{
"Name":"c.name",
"Path":"c.path"
}
]
}