# Extract Specific data from Array

**URL:** <https://discourse.nodered.org/t/extract-specific-data-from-array/12628>\
**Category:** General\
**Created:** [26 June 2019 19:38 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628 "2019-06-26T19:38:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjbhuyan](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@mjbhuyan](https://discourse.nodered.org/u/mjbhuyan)\
**Post date:** [26 June 2019 19:38 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628/1 "2019-06-26T19:38:28Z")

</div>

Hi there,

I'm try to extract a specific data from a field, but I'm getting the following error. I would greatly appreciate if someone could help me out .

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/193f98906bfbc89b8dbe8daafc2bbb22c0e456af.png)

Thank you in advance.

Kind Regards

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2019 19:41 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628/2 "2019-06-26T19:41:39Z")

</div>

Expand the array in debug window. Perhaps element [1] is undefined.

You should probably check an object is not undefined before accessing a property of it.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2019 19:43 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628/3 "2019-06-26T19:43:15Z")

</div>

Forget that. Just realized your first iteration in the loop overwrites msg.payload.

You are literally destroying the payload object on the first loop.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 June 2019 19:45 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628/4 "2019-06-26T19:45:03Z")

</div>

Is this is a duplicate topic ? from [Extract Data from Many Array](https://discourse.nodered.org/t/extract-data-from-many-array/5525/3)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2019 19:46 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628/5 "2019-06-26T19:46:02Z")

</div>

In fact looking again, why would you loop through an array and copy a fields value to the same payload property 28 times anyway?

Additionally, is there always 28 items? Surely you would only want to loop the loop while \< msg.payloads.feeds.length

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2019 19:47 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628/6 "2019-06-26T19:47:04Z")

</div>

Looks like it.

Naughty OP 😉

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 June 2019 20:11 UTC](https://discourse.nodered.org/t/extract-specific-data-from-array/12628/7 "2019-06-26T20:11:25Z")

</div>


