{
"id":0,
"item":[
{
"id":"0-",
"text":"BlueWing",
"userdata":[
{
"name":"cid",
"content":"10377"
}
],
"item":[
{
"id":"0-0",
"text":"Auto",
"userdata":[
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388,10533"
}
],
"item":[
{
"id":"0-0-0",
"text":"Auto",
"userdata":[
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
}
],
"item":[
{
"id":"0-0-0-0",
"text":"testaccount",
"userdata":[
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
}
],
"item":[
{
"id":"0-0-0-0-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
}
]
},
{
"id":"0-0-0-0-1",
"text":"testaccount",
"userdata":[
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
}
],
"item":[
{
"id":"0-0-0-0-1-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
}
]
},
{
"id":"0-0-0-0-1-1",
"text":"testaccount - 10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388",
"userdata":[
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
}
],
"item":[
{
"id":"0-0-0-0-1-1-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10377,10376,10378,10387,10379,10384,10386,10380,10383,10385,10381,10388"
}
]
}
]
}
]
}
]
}
]
},
{
"id":"0-0-1",
"text":"Balise Toyota",
"userdata":[
{
"name":"cid",
"content":"10533"
}
],
"item":[
{
"id":"0-0-1-0",
"text":"Balise Toyota",
"userdata":[
{
"name":"cid",
"content":"10533"
}
],
"item":[
{
"id":"0-0-1-0-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10533"
}
]
},
{
"id":"0-0-1-0-1",
"text":"Balise Toyota",
"userdata":[
{
"name":"cid",
"content":"10533"
}
],
"item":[
{
"id":"0-0-1-0-1-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10533"
}
]
},
{
"id":"0-0-1-0-1-1",
"text":"Balise Toyota - 10533",
"userdata":[
{
"name":"cid",
"content":"10533"
}
],
"item":[
{
"id":"0-0-1-0-1-1-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10533"
}
]
},
{
"id":"0-0-1-0-1-1-1",
"text":"Balise.List - 11949",
"userdata":[
{
"name":"clid",
"content":11949
},
{
"name":"cid",
"content":"10533"
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"id":"0-1",
"text":"BlueWing",
"userdata":[
{
"name":"cid",
"content":"10667,10668"
}
],
"item":[
{
"id":"0-1-0",
"text":"HVAC",
"userdata":[
{
"name":"cid",
"content":"10667,10668,10348,10294,10297,10313,10521,10351,10309,10296,10316,10315,10312,10301,10347,10300,10306,10308,10307,10298,10305,10371,10291,10349,10311,10354,10345,10310,10292,10372,10295,10304,10303,10299,10314,10290,10490,10293,10302"
}
],
"item":[
{
"id":"0-1-0-0",
"text":"HVAC",
"userdata":[
{
"name":"cid",
"content":"10667,10668"
}
],
"item":[
{
"id":"0-1-0-0-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10667,10668"
}
]
},
{
"id":"0-1-0-0-1",
"text":"Mann Plumbing & Heating",
"userdata":[
{
"name":"cid",
"content":"10667"
}
],
"item":[
{
"id":"0-1-0-0-1-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10667"
}
]
},
{
"id":"0-1-0-0-1-1",
"text":"Mann Plumbing & Heating - 10667",
"userdata":[
{
"name":"cid",
"content":"10667"
}
],
"item":[
{
"id":"0-1-0-0-1-1-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10667"
}
]
},
{
"id":"0-1-0-0-1-1-1",
"text":"Radius List - 12960",
"userdata":[
{
"name":"clid",
"content":12960
},
{
"name":"cid",
"content":"10667"
}
]
}
]
}
]
},
{
"id":"0-1-0-0-2",
"text":"RES Air Conditioning",
"userdata":[
{
"name":"cid",
"content":"10668"
}
],
"item":[
{
"id":"0-1-0-0-2-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10668"
}
]
},
{
"id":"0-1-0-0-2-1",
"text":"RES Air Conditioning - 10668",
"userdata":[
{
"name":"cid",
"content":"10668"
}
],
"item":[
{
"id":"0-1-0-0-2-1-0",
"text":"Add New List",
"userdata":[
{
"name":"clid",
"content":99999
},
{
"name":"cid",
"content":"10668"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
すべてのレベルを繰り返し、 "id"で一致させ、 "content"の値を取得する必要があります。JavaScript JSONマルチレベル反復構文解析
var id = "0-1-0-0-0";
JSONのid
は、IDと一致した場合、その後content
の値を返します。 返信する必要があります10667,10668
ありがとうございます!
、あなたは何を試してみましたか? –
多くのことを試してみましたが、必要な出力に近くなるものはありません。私が得た最も近いものは 'console.log(getObjects(json、 'id'、" 0-1-0-0-0 "));ですが、返すコンテンツを取得することはできません。 – Kim