동적으로 생성되고 명확한 구조가없는 JSON 파일을 구문 분석하고 싶습니다.C#에서 jstree 용으로 생성 된 json 파일을 구문 분석합니다.
[
{
"children": [
{
"children": [
{
"children": [],
"text": "Child node 2.txt",
"isFolder": false,
"id": "1childnode2.txt",
"itsPath": "C:\\Users\\pandyapa\\Root node\\Child node 2.txt",
"type": "itsfile"
}
],
"text": "Child node 1.txt",
"isFolder": false,
"id": "0childnode1.txt",
"itsPath": "C:\\Users\\pandyapa\\Root node\\Child node 1.txt",
"type": "itsfile"
},
{
"children": [],
"text": "Child node 2.txt",
"isFolder": false,
"id": "1childnode2.txt",
"itsPath": "C:\\Users\\pandyapa\\Root node\\Child node 2.txt",
"type": "itsfile"
},
{
"children": [],
"text": "Child node 3.txt",
"isFolder": false,
"id": "2childnode3.txt",
"itsPath": "C:\\Users\\pandyapa\\Root node\\Child node 3.txt",
"type": "itsfile"
}
],
"text": "Root node",
"isFolder": true,
"id": "3rootnode",
"itsPath": "C:\\Users\\pandyapa\\Root node",
"type": "default"
}
]
이 JSON에는 중첩 된 하위 항목이있을 수 있습니다. 각 JSON 객체를 구문 분석하고 "id"키를 비교하여 "itspath"값을 검색하려고합니다. 시도했지만 실패했습니다. 어떤 도움을 주셔서 감사합니다. 그것은 당신의 JSON처럼 나에게 보이는
읽기 [질문] 당신의 시도를 보여주고 그들이 어떻게 실패
바이올린을 :
지금 당신은 ID에 의해 특정 노드를 찾기 위해이 작업을 수행 할 수 있습니다. – CodeCaster
시도해주세요, @Parth : http://stackoverflow.com/questions/17038810/newtonsoft-json-deserialize – Alexandru