json目录结构.. [英] json directory structure..

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

问题描述

大家好.
如何将目录结构转换为json ....?
如果有人知道,请让我知道....

hi to all..
how to convert directory structure into json....?
if any body knows pls let me know....

推荐答案



选中此 [ ^ ]
Hi,

Check this[^]


将目录结构表示为您选择的数据结构,并使用类System.Runtime.Serialization.Json.DataContractJsonSerializer.在数据类型(例如DataContractDataMember)中使用适当的属性来定义数据合同.它将帮助您存储任何对象图,并使用JSON文件/流将其还原回以进行持久存储.您无需以任何方式手动编程持久性,这将使您的实现极其简单和健壮.

参见:
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/ms733127.aspx [ ^ ].

另请参阅我过去提倡使用数据合约的答案:
如何在我的表单应用程序? [ ^ ],
创建属性文件... [反序列化json字符串数组 [
Represent directory structure as data structure of your choice and use the class System.Runtime.Serialization.Json.DataContractJsonSerializer. Use appropriate attributes in data type(s), such as DataContract and DataMember, to define a Data Contract. It will help you to store any object graph and restore it back using JSON file/stream for persistent storage. You won''t need to program persistence manually in any way which will make your implementation extremely simple and robust.

See:
http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer.aspx[^],
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].

Please also see my past answer where I advocate using Data Contracts:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating a property files...[^],
deseralize a json string array[^].

First two of my answers are about System.Runtime.Serialization.Json.DataContractSerializer but are also applicable to System.Runtime.Serialization.Json.DataContractJsonSerializer.

—SA


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

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