JSFiddle - React, Tailwind, and code Playground
by Hakan Bilgin
HTML
<script src="http://defiantjs.com/defiant.js/dist/defiant-latest.min.js"></script>
<div id="output"></div>
JavaScript
var data = [
{
"id": {
"type": "literal",
"value": "123456789",
"datatype": "http://www.w3.org/2001/XMLSchema#string"
},
"name": {
"type": "literal",
"value": "John Doe",
"datatype": "http://www.w3.org/2001/XMLSchema#string"
}
},
{
"id": {
"type": "literal",
"value": "2123456789",
"datatype": "http://www.w3.org/2001/XMLSchema#string"
},
"name": {
"type": "literal",
"value": "Jane Doe",
"datatype": "http://www.w3.org/2001/XMLSchema#string"
}
}
],
found = JSON.search(data, '//value'),
str = '';
for (var i=0; i<found.length; i++) {
str += found[i] +'<br/>';
}
document.getElementById('output').innerHTML = str;