# Can't use .length in my array data

**URL:** <https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721>\
**Category:** General\
**Created:** [25 January 2021 18:20 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721 "2021-01-25T18:20:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![morathekid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/morathekid/32/35907_2.png) [@morathekid](https://discourse.nodered.org/u/morathekid)\
**Post date:** [25 January 2021 18:20 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/1 "2021-01-25T18:20:07Z")

</div>

in my array has two data. but node script can't length it  
Data :  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/5/c5017f838c82ef65c3f86172912c8dbd330f8d2e.png)

```json
{"rootId":"0759da852d9fb76f79297e8cfc3d6ce7","requestId":"f396bc7dc58796e5:-644c5706:176e12ece07:-8000:3924","details":{"tlp":2,"caseTemplate":null,"description":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66 at 2021-01-24T03:32:04","tags":["Logthyrhm","Automate"],"lastSyncDate":1611600578646,"customFields":{"alertRule":{"order":0,"string":"AIE: TLI - Command Shell Possible Success"},"application":{"order":1,"string":""},"destinationPort":{"order":3,"string":"80"},"sourcePort":{"order":2,"string":"80"}},"status":"New","severity":2,"title":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66","follow":true},"operation":"Creation","objectId":"0759da852d9fb76f79297e8cfc3d6ce7","startDate":1611600578713,"objectType":"alert","base":true,"object":{"_routing":"0759da852d9fb76f79297e8cfc3d6ce7","date":1611600578000,"severity":2,"customFields":{"alertRule":{"order":0,"string":"AIE: TLI - Command Shell Possible Success"},"application":{"order":1,"string":""},"destinationPort":{"order":3,"string":"80"},"sourcePort":{"order":2,"string":"80"}},"caseTemplate":null,"_type":"alert","description":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66 at 2021-01-24T03:32:04","lastSyncDate":1611600578646,"source":"172.25.5.20","title":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66","type":"Attack","follow":true,"tags":["Logthyrhm","Automate"],"createdAt":1611600578646,"_parent":null,"createdBy":"apiuser","tlp":2,"_id":"0759da852d9fb76f79297e8cfc3d6ce7","id":"0759da852d9fb76f79297e8cfc3d6ce7","sourceRef":"aa51b4","_version":1,"artifacts":[{"tlp":2,"tags":[],"data":"27.75.99.4","ioc":false,"sighted":false,"message":null,"dataType":"ip"},{"tlp":2,"tags":[],"data":"113.53.233.66","ioc":false,"sighted":false,"message":null,"dataType":"ip"}],"status":"New"}}

```

My code  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dc20979b35930c166f8c63cb8464d4fae3f6a3a9.png)

what's wrong ?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [25 January 2021 18:34 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/2 "2021-01-25T18:34:48Z")

</div>

Not sure as can not see the objects origin in the image, but maybe it's `msg.artifacts`

---

<div class="post-metadata">

**Author:** ![morathekid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/morathekid/32/35907_2.png) [@morathekid](https://discourse.nodered.org/u/morathekid)\
**Post date:** [25 January 2021 18:50 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/3 "2021-01-25T18:50:44Z")

</div>

```json
{"rootId":"0759da852d9fb76f79297e8cfc3d6ce7","requestId":"f396bc7dc58796e5:-644c5706:176e12ece07:-8000:3924","details":{"tlp":2,"caseTemplate":null,"description":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66 at 2021-01-24T03:32:04","tags":["Logthyrhm","Automate"],"lastSyncDate":1611600578646,"customFields":{"alertRule":{"order":0,"string":"AIE: TLI - Command Shell Possible Success"},"application":{"order":1,"string":""},"destinationPort":{"order":3,"string":"80"},"sourcePort":{"order":2,"string":"80"}},"status":"New","severity":2,"title":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66","follow":true},"operation":"Creation","objectId":"0759da852d9fb76f79297e8cfc3d6ce7","startDate":1611600578713,"objectType":"alert","base":true,"object":{"_routing":"0759da852d9fb76f79297e8cfc3d6ce7","date":1611600578000,"severity":2,"customFields":{"alertRule":{"order":0,"string":"AIE: TLI - Command Shell Possible Success"},"application":{"order":1,"string":""},"destinationPort":{"order":3,"string":"80"},"sourcePort":{"order":2,"string":"80"}},"caseTemplate":null,"_type":"alert","description":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66 at 2021-01-24T03:32:04","lastSyncDate":1611600578646,"source":"172.25.5.20","title":"AIE: TLI - Command Shell Possible Success from 27.75.99.4 to 113.53.233.66","type":"Attack","follow":true,"tags":["Logthyrhm","Automate"],"createdAt":1611600578646,"_parent":null,"createdBy":"apiuser","tlp":2,"_id":"0759da852d9fb76f79297e8cfc3d6ce7","id":"0759da852d9fb76f79297e8cfc3d6ce7","sourceRef":"aa51b4","_version":1,"artifacts":[{"tlp":2,"tags":[],"data":"27.75.99.4","ioc":false,"sighted":false,"message":null,"dataType":"ip"},{"tlp":2,"tags":[],"data":"113.53.233.66","ioc":false,"sighted":false,"message":null,"dataType":"ip"}],"status":"New"}}

```

it's all object

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [25 January 2021 18:55 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/4 "2021-01-25T18:55:08Z")

</div>

```auto
msg.payload.object.artifacts

```

Read this it will tell you how to find paths, using the debug panel.  
[https://nodered.org/docs/user-guide/messages#understanding-the-structure-of-a-message](https://nodered.org/docs/user-guide/messages#understanding-the-structure-of-a-message)

---

<div class="post-metadata">

**Author:** ![morathekid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/morathekid/32/35907_2.png) [@morathekid](https://discourse.nodered.org/u/morathekid)\
**Post date:** [26 January 2021 06:06 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/5 "2021-01-26T06:06:38Z")

</div>

> [@E1cid](#):
>
> `object`

it's still same  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/e/4efe18e7ebb7f422716eb487836edc5c700389fe.png)

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [26 January 2021 07:06 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/6 "2021-01-26T07:06:12Z")

</div>

Then you are not showing the whole object, is `object` living inside `msg.payload` or in just `msg` ?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 January 2021 07:21 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/7 "2021-01-26T07:21:08Z")

</div>

Feed the incoming message into a debug node set to show Complete Message and post a screenshot here. Then we will understand what you have.  
Have you read and understood the document linked earlier?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 March 2021 07:21 UTC](https://discourse.nodered.org/t/cant-use-length-in-my-array-data/39721/8 "2021-03-27T07:21:51Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
