{"id":7191,"date":"2025-03-05T06:22:15","date_gmt":"2025-03-05T06:22:15","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=7191"},"modified":"2025-03-06T04:33:10","modified_gmt":"2025-03-06T04:33:10","slug":"how-to-search-for-object-in-array-of-objects-in-javascript","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/","title":{"rendered":"How to Search For Object in Array of Objects in JavaScript"},"content":{"rendered":"\n<p>JavaScript developers often use array of literal objects to store data as key-value pairs. They allow you to store diverse types of data in a compact manner. You can easily convert it into JSON data and vice versa. Many times, you may need to search for one or more objects in an array of objects. This can be difficult to  do for many beginner web developers, due to the complex structure of literal objects. But there are several powerful ways to look for one or more items in an array of objects. In this article, we will learn how to search for object in array of objects in JavaScript.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#How_to_Search_For_Object_in_Array_of_Objects_in_JavaScript\" >How to Search For Object in Array of Objects in JavaScript<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#1_Search_One_Object\" >1. Search One Object<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#2_Search_Multiple_Objects\" >2. Search Multiple Objects<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#3_Search_Specific_Properties\" >3. Search Specific Properties<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#4_Search_for_Multiple_Conditions\" >4. Search for Multiple Conditions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Search_For_Object_in_Array_of_Objects_in_JavaScript\"><\/span>How to Search For Object in Array of Objects in JavaScript<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are the different ways to search object in JavaScript array of objects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Search_One_Object\"><\/span>1. Search One Object<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this case, we need to find only one object or object&#8217;s property from an array of objects.<\/p>\n\n\n\n<p>Let us say you have the following array of objects.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array = [{'id':'1','name':'joe'},{'id':'2','name':'jane'}];<\/pre>\n\n\n\n<p>Let us say you want to search for object with id=2 in this array. You can easily do this using find() function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function check_item(x) {<br>  return x.id === '2';<br>}<br><br>console.log(array.find(check_item)); \/\/ output is { id: '2', name: 'jane' }<br><\/pre>\n\n\n\n<p>Every JS array supports find() method out of the box. It returns the first element that satisfies a specific condition. It executes a test function for each item of the array and returns the first item that passes the test function. In our case, it executes check_item() function on each item of the array, and in this function it checks whether the id property of the item is 2.<\/p>\n\n\n\n<p>You can also shorten the above code using an arrow function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array.find(x => x.id === '2')<br><br>OR<br><br>console.log(array.find(x => x.id === '2'));  \/\/ output is { id: '2', name: 'jane' }<\/pre>\n\n\n\n<p>In each of the above case, it returns the entire object in result. <\/p>\n\n\n\n<p>Please note, if the searched item does not exist, then it will return <em>undefined<\/em>.<\/p>\n\n\n\n<p>If you only want a specific property of an item, then you can specify it using dot notation as shown below. <\/p>\n\n\n\n<p>Here is an example to get the name property&#8217;s value of object where id=2.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">console.log(array.find(x => x.id === '2'))<strong>.name<\/strong>;  \/\/ output is jane<\/pre>\n\n\n\n<p>Here is the above code using traditional function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function check_item(x) {<br>  return x.id === '2';<br>}<br><br>console.log(array.find(check_item)<strong>.name<\/strong>);<\/pre>\n\n\n\n<p>Please note, if the searched item does not exist in this case, then it will throw an error saying &#8216;cannot read properties of undefined&#8217;. So when you are looking for a property of a specific item in array of objects, it is better to wrap the code in try..catch block to avoid errors.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">try{<br>    console.log(array.find(x => x.id === '20').name);<br>}catch{<br>    console.log('item not found. so property does not exist');<br>}<\/pre>\n\n\n\n<p>If you want to get the index of a specific item, then you can use findIndex() function. It is similar to find() function, but it returns the index of the first matched item. Like find(), it will also execute a test function on each item of the array, but return the index of the first item that passes the test function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function check_item(x) {<br>  return x.id === '2';<br>}<br><br>console.log(array.findIndex(check_item)); \/\/ output is 1<br><br>OR<br><br>console.log(array.findIndex(x => x.id === '2'));  \/\/ output is 1<\/pre>\n\n\n\n<p>If the searched item does not exist, it will return -1 as result.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">console.log(array.findIndex(x => x.id === '20')); \/\/ output is -1<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Search_Multiple_Objects\"><\/span>2. Search Multiple Objects<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>When you use find() or findIndex() function as shown above, it will stop searching once it finds the first matching item. Sometimes, there may be multiple instances of a given property. In this case, you need to use filter() function. <\/p>\n\n\n\n<p>The main difference between find() and filter() is that find() function executes a test function for every item of the array until an element passes the test, but filter() function continues to execute the test function until it does so for all items of the array. <\/p>\n\n\n\n<p>Its syntax is similar to that of find() function mentioned above. Let us say you have the following array, with multiple objects where id=2.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array = [{'id':'1','name':'joe'},{'id':'2','name':'jane'}, {'id':'2','name':'jim'}];<\/pre>\n\n\n\n<p>Here is how to search all objects where id=2.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function check_item(x) {<br>  return x.id === '2';<br>}<br><br>console.log(array.filter(check_item));  \/\/ output is [ { id: '2', name: 'jane' }, { id: '2', name: 'jim' } ]<\/pre>\n\n\n\n<p>You can shorten the above code by using arrow functions. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">console.log(array.filter(x => x.id === '2'));  \/\/ output is [ { id: '2', name: 'jane' }, { id: '2', name: 'jim' } ]<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Search_Specific_Properties\"><\/span>3. Search Specific Properties<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the above case, we get an array of objects as a result of search. If you only want an array of specific properties of matching objects, then you need to use map() function along with filter() function as shown. Here is an example to return an array of <em>name<\/em> property of objects that match search criteria.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">console.log(array.filter(x => x.id === '2').map(x => x.name));<\/pre>\n\n\n\n<p>Here is the output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ 'jane', 'jim' ]<\/pre>\n\n\n\n<p>This is very useful, if you have large objects or many instances of matching items, and are only looking for specific property of matching items.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Search_for_Multiple_Conditions\"><\/span>4. Search for Multiple Conditions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>So far, we have looked at searching for items using a single condition. If you want to search objects using multiple conditions, then you can combine conditions using &amp;&amp; (AND)\/ || (OR) operators. Let us say you have the following array of objects.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">array = [{'id':'1','name':'joe'},{'id':'2','name':'jane'}, {'id':'2','name':'jim'}];<\/pre>\n\n\n\n<p>If you only want to look for first occurrence of an object, use find() function. If you want an array of all matching objects, use filter() function.<\/p>\n\n\n\n<p>Here is an example to look for object where id=2 and name=&#8217;jim&#8217;.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">console.log(array.find(x => x.id === '2' &amp;&amp; x.name ==='jim')); \/\/ output is { id: '2', name: 'jim' }<\/pre>\n\n\n\n<p>Here is the above example using filter() function. Output will be an array.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">console.log(array.filter(x => x.id === '2' &amp;&amp; x.name ==='jim')); \/\/ output is [ { id: '2', name: 'jim' } ]<\/pre>\n\n\n\n<p>Here are the above examples using traditional functions, instead of arrow functions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">function check_item(x) {<br>  return x.id === '2' &amp;&amp; x.name==='jim';<br>}<br><br>console.log(array.find(check_item)); \/\/ output is { id: '2', name: 'jim' }<br><br>OR<br><br>console.log(array.filter(check_item)); \/\/ output is [{ id: '2', name: 'jim' }]<br><\/pre>\n\n\n\n<p>Please note, in all above cases, we have used === operator. You can also use == operator instead.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt several different ways to search for object in array of objects in JavaScript. First, we learnt how to find single occurrence of an item in array of objects using find() function. Then we learnt how to get an array of matching items, using filter() function, in case there are multiple occurrences of matching objects. We also learnt how to get only the required property values of matching objects, instead of fetching the entire object, using map() function. Lastly, we learnt how to search objects based on multiple conditions using and\/or operators. You can use any of these solutions, based on your requirements.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-add-new-elements-to-beginning-of-array-in-javascript\/\">How to Add New Elements to Beginning of Array<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-unique-values-in-javascript-array\/\">How to Get Unique Values in JavaScript Array<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-copy-array-in-javascript\/\">How to Copy Array in JavaScript<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes you may need to find one or more objects in an array of objects. Here is how to search for object in array of objects in JavaScript.<\/p>\n","protected":false},"author":1,"featured_media":7209,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[295],"tags":[392],"class_list":["post-7191","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-search-object"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Search For Object in Array of Objects in JavaScript - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes you may need to find one or more objects in an array of objects. Here is how to search for object in array of objects in JavaScript.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Search For Object in Array of Objects in JavaScript - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes you may need to find one or more objects in an array of objects. Here is how to search for object in array of objects in JavaScript.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2025-03-05T06:22:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-06T04:33:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/03\/search-object-in-array-of-objects.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"260\" \/>\n\t<meta property=\"og:image:height\" content=\"195\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Search For Object in Array of Objects in JavaScript\",\"datePublished\":\"2025-03-05T06:22:15+00:00\",\"dateModified\":\"2025-03-06T04:33:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/\"},\"wordCount\":959,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1\",\"keywords\":[\"search object\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/\",\"name\":\"How to Search For Object in Array of Objects in JavaScript - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1\",\"datePublished\":\"2025-03-05T06:22:15+00:00\",\"dateModified\":\"2025-03-06T04:33:10+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes you may need to find one or more objects in an array of objects. Here is how to search for object in array of objects in JavaScript.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1\",\"width\":260,\"height\":195,\"caption\":\"search object in array of objects\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-search-for-object-in-array-of-objects-in-javascript\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Search For Object in Array of Objects in JavaScript\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Search For Object in Array of Objects in JavaScript - Ubiq BI","description":"Sometimes you may need to find one or more objects in an array of objects. Here is how to search for object in array of objects in JavaScript.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Search For Object in Array of Objects in JavaScript - Ubiq BI","og_description":"Sometimes you may need to find one or more objects in an array of objects. Here is how to search for object in array of objects in JavaScript.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2025-03-05T06:22:15+00:00","article_modified_time":"2025-03-06T04:33:10+00:00","og_image":[{"width":260,"height":195,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/03\/search-object-in-array-of-objects.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Search For Object in Array of Objects in JavaScript","datePublished":"2025-03-05T06:22:15+00:00","dateModified":"2025-03-06T04:33:10+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/"},"wordCount":959,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/03\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1","keywords":["search object"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/","name":"How to Search For Object in Array of Objects in JavaScript - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/03\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1","datePublished":"2025-03-05T06:22:15+00:00","dateModified":"2025-03-06T04:33:10+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes you may need to find one or more objects in an array of objects. Here is how to search for object in array of objects in JavaScript.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/03\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/03\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1","width":260,"height":195,"caption":"search object in array of objects"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-search-for-object-in-array-of-objects-in-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Search For Object in Array of Objects in JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2025\/03\/search-object-in-array-of-objects.jpg?fit=260%2C195&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1RZ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=7191"}],"version-history":[{"count":18,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7191\/revisions"}],"predecessor-version":[{"id":7215,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/7191\/revisions\/7215"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/7209"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=7191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=7191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=7191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}