CSS-like selectors for JSON
JSONSelect
Can you please take a look at this Demo and let me know why I am not able to Query the json object by using the jsonSelect plugin?
var jsonData = {
"name": {
"first": "Lloyd",
"last": "Hilaiel"
},
"favoriteColor": "yellow",
"languagesSpoken": [{
"language": "Bulgarian",
"level": 2
}, {
"language": "English",
"level": 1
}, {
"language": "Spanish",
"level": 7
}]
};
var selector = '.name > *';
JSONSelect.forEach(selector, jsonData, function (resultObj) {
$('body').append('<p>' + $.trim(JSON.stringify(resultObj, null, ' ')) + '</p>');
});
Thanks
Source: (StackOverflow)