如何在json中序列化整个目录结构... [英] how to serialize the entire directory structure in json...

查看:94
本文介绍了如何在json中序列化整个目录结构...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

实际上是发生了wat..i,我在"D"中创建了示例文件夹,然后又创建了SAMPLE FOLDER,再次创建了HELLO FOLDER和一个.txt文件,在HELLO FOLDER中,我创建了两个.txt文件. > 在该代码中,我采用默认路径,例如"D:\ sample".上面的整个目录结构显示为字符串..
字符串是这样的:abc.txt你好xyz.txt pqr.txt ..
现在我想对entrire目录结构进行序列化,并且我想要这样的输出:
{根":"d:\\" {主文件夹":样本","mfile":"abc.txt",子文件夹":"hello" {"hfile1" ;:"xyz.txt","hfile2":"pqr.txt"}}}} ..
如果有人知道请让我知道..
在此先感谢..

hi to all..

actuually wat happend means..i create sample folder in ''D'' and in that i created SAMPLE FOLDER ,again i created HELLO FOLDER and one .txt file, in that HELLO FOLDER i created two .txt files..
in that code i take default path like "D:\sample" the above entire directory structure displayed like as a string..
string is like this: abc.txt hello xyz.txt pqr.txt..
now i want to serilaize the entrire directory structure and i want the output like this:
{"Root":"d:\\"{"mainfolder":"sample","mfile":"abc.txt","subfolder":"hello"{"hfile1":"xyz.txt","hfile2":"pqr.txt"}}}..
if any body knows pls let me know..
thanks in advance..

推荐答案

查看 fastJSON [ ^ ]用于JSON部分.
然后查看 DirectoryInfo类 [ FileInfo类 [
Check out fastJSON[^] for the JSON part.
And look at DirectoryInfo Class[^] and FileInfo Class[^] for folder and file info.


这篇关于如何在json中序列化整个目录结构...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆