JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://defiantjs.com/defiant.js/dist/defiant-latest.min.js"></script>
<div id="output"></div>
JavaScript
var data = {
"board": {
"zones": {
"1": {
"zoneID": 1,
"zoneType": "big"
},
"2": {
"zoneID": 2,
"zoneType": "small"
},
"3": {
"zoneID": 3,
"zoneType": "small"
},
"4": {
"zoneID": 4,
"zoneType": "big"
}
}
}
},
found = JSON.search(data, '//*[zoneType="small"]'),
str = '';
for (var i=0; i<found.length; i++) {
str += found[i].zoneID +'<br/>';
}
document.getElementById('output').innerHTML = str;