JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://www.defiantjs.com/defiant.js/dist/defiant-latest.min.js"></script>
<div id="maindiv">
</div>
JavaScript
var json = {
"hierarchy": {
"date": "2014/09/24 15:21:23",
"folder": {
"name": "Root",
"id": "Root",
"file": [{
"id": "22U2621210__PIN_検査報告書Ver1.0_20140923162232.xls"
}, {
"id": "C22-1(EU仕様)_20140923162409.xlsx"
}, {
"id": "Machine_Inspection_20140923162329.xlsx"
}],
"folder": {
"name": "Level-1",
"id": "1411396172645",
"file": {
"id": "22U2621210__PIN_検査報告書Ver1.0_20140923162232.xls"
},
"folder": {
"name": "123",
"id": "1411538469568",
"file": [{
"id": "C22-1(EU仕様)_20140923162409.xlsx"
}, {
"id": "Machine_Inspection_20140923162329.xlsx"
}]
}
}
}
}
};
var jsonStr = JSON.stringify(json);
var ids = JSON.search(json, "//*[name = 'Root' and id = 'Root']/file/id");
for (var i=0; i< ids.length; i++) {
$("#maindiv").append("<p>" + ids[i] + "</p");
//console.log( Defiant.node.prettyPrint( ids[i] ) );
}