How to check if values in one JavaScript object are present in another one?
<p>I am trying to compare json_str1 and json_str2, here it should return true as all elements in json_str1 are present in json_str2.</p>

<p>For now I am doing this the long way like this</p>

<pre><code>json_str1 = '{"0":"a","1":"b","2":"c"}';
json_str2 = '{"0":"c","1":"b","2":"a"}';

json_obj1 = $.parseJSON(json_str1);
json_obj2 = $.parseJSON(json_str2);

arr1 = $.map(json_obj1, function(el) { return el });
arr2 = $.map(json_obj2, function(el) { return el });

if($(arr1).not(arr2).length === 0 &amp;&amp; $(arr2).not(arr1).length === 0)
    alert("equal");
else
    alert("not equal");
</code></pre>

<p>How could I make it short and simple, without converting the objects into an array ?</p>

<p><a href="https://jsfiddle.net/kq9gtdr0/">https://jsfiddle.net/kq9gtdr0/</a></p>