JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.1.min.js"></script>
JavaScript
var str = '{"hoo":1,"match":{"foo":["a"],"bar":["o","i", "u"],"baz":["y", "t"]}}';
var strJson = JSON.parse(str);
var filter = '[{"name":"foo","with":[{"name":"a","bar":"b","baz":"c"},{"name":"q","bar":"b","baz":"c"},{"name":"w","bar":"b","baz":"c"}]},{"name":"bar","bar":[{"name":"a","bar":"b","baz":"c"},{"name":"q","bar":"b","baz":"c"},{"name":"w","bar":"b","baz":"c"}]}]';
var filterJson = JSON.parse(filter);
//console.log(strJson);
//console.log(filterJson);
$.each(filterJson, function (akey, avalue) {
window.setTimeout(function () {
$.each(strJson.match, function (bkey, bvalue) {
window.setTimeout(function () {
$.each(bvalue, function (ckey, cvalue) {
window.setTimeout(function () {
$.each(avalue.with, function (dkey, dvalue) {
window.setTimeout(function () {
if ( bvalue.indexOf(dvalue.name) !== -1 ) {
console.log('present');
} else {
console.log('not present');
}
}, 10);
});
}, 10);
});
}, 10);
});
}, 10);
});