[英]What is the best way of getting a json object tree from a parent child relation
Say I have a list of parent-child related folders. 说我有一个与父子相关的文件夹的列表。 How can I get the following specific json object to be used by angular mat tree:
如何获得以下特定的json对象供角垫树使用:
Note: the list for this will indicate Groceries and reminders are root, fruits is subfolder to groceries. 注意:此列表将指示杂货和提醒是根,水果是杂货的子文件夹。
Use https://www.newtonsoft.com/json to serialize any C# Object to JSON 使用https://www.newtonsoft.com/json将任何C#对象序列化为JSON
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Sizes = new string[] { "Small" };
string json = JsonConvert.SerializeObject(product);
// {
// "Name": "Apple",
// "Expiry": "2008-12-28T00:00:00",
// "Sizes": [
// "Small"
// ]
// }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.