{
"Main":
{
"subfolder" :
{
"photos" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
},
"photos_of_camera" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
}
},
"subfolder_1" :
{
"photos" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
},
"photos_of_camera" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
}
}
},
"Root":
{
"subfolder" :
{
"photos" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
},
"photos_of_camera" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
}
},
"subfolder_1" :
{
"photos" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
},
"photos_of_camera" :
{
"January" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"February" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"March" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"April" :
{
"name" : "Detail of photo",
"date": "id of photo",
"location": "location detail"
},
"May" :
{
"name" : "Detail of photo",
"date": "id of photo"
}
}
}
}
}
У меня есть такие данные.
Я хочу получить все свойства и их значение, если оно есть.
Я смог получить только первый дочерний элемент, используя пакет Newtonsoft.json, используя такой код
string a = File.ReadAllText(@"json file path");
List<string> read(string file)
{
JObject jObject = JObject.Parse(file);
foreach(JProperty i in jObject.Properties())
{
var name = i.Name;
Console.WriteLine(bb);
}
var child = jObject.First.First;
if(!st.HasValues)
{
Console.WriteLine(child.ToString());
return null;
}
string cnr = Convert.ToString(child);
return recursion(cnr);
}
recursion(a);
Но это дает мне только данные первого ребенка, только вот так
Главная
Root
вложенная
subfolder_1
фотографии
photos_of_camera
Январь
Февраль
Март
Апрель
Май
имя
дата
место
Деталь фото
но я хочу все свойства и их значение, так что кто-нибудь может мне помочь ??