# Displaying a list of Numbers from an array of objects

**URL:** <https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388>\
**Category:** Dashboard\
**Created:** [29 September 2022 13:17 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388 "2022-09-29T13:17:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dereine](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dereine](https://discourse.nodered.org/u/dereine)\
**Post date:** [29 September 2022 13:17 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/1 "2022-09-29T13:17:46Z")

</div>

good day

I have the problem when outputting from a json The output payload looks like this:  
"{{msg.payload.value[0].callerNumber}}"  
This works fine so far. But I have a dynamic number as value. So not only 0 or 1 or 2 etc. but it is about a phone log history. I.e. I read the log from teams and there are more than only one number which should be read. This array also grows and I will still include that you can enter a date range, so there will be more output.  
How can I include that all values of, in this example "Caller Number" are output in a list?

---

<div class="post-metadata">

**Author:** ![dereine](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dereine](https://discourse.nodered.org/u/dereine)\
**Post date:** [1 October 2022 16:29 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/2 "2022-10-01T16:29:17Z")

</div>

So there are no solution for this?

---

<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:** [1 October 2022 16:37 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/3 "2022-10-01T16:37:55Z")

</div>

Of course there is always a solution however I personally skipped this one because I could not really see what you wanted?

You ask in the #general category (meaning its NOT a #dashboard thing) with a title "Number setting in json output" (which suggests you want to set values in some json) ask how you can get "Caller Number" output in a list (does that mean on a dashboard? in an array? in msg.payload only?)

Maybe if you showed sample data and explained exactly where and how you want it to appear?

---

<div class="post-metadata">

**Author:** ![dereine](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dereine](https://discourse.nodered.org/u/dereine)\
**Post date:** [6 October 2022 06:22 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/4 "2022-10-06T06:22:41Z")

</div>

I apologize for the late reply and putting the wrong forum group.

It looks like this:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cf0fc98fdeb5341821bcb03e60d1602be2d3903b.png)

I get the call logs via the MS api for teams

Reading a number works. But the JSON always contains more than one number because I want to read the history of a day and display it in a list.  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/9/b94686c0965726689776d59898bb411b458b3fa1.png)

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/238cb4a4eeeb293c42077e3a650fcabb7952f108.png)

So how can I display them in a list?

---

<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:** [6 October 2022 08:16 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/5 "2022-10-06T08:16:55Z")

</div>

OK, now it makes more sense.

I have updated the category and the title to attract the kind of guys who can help with these type of questions.

If this were my dashboard, I would simply install [node-red-node-ui-table](https://flows.nodered.org/node/node-red-node-ui-table) and display the list in tabular format.

---

<div class="post-metadata">

**Author:** ![dereine](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dereine](https://discourse.nodered.org/u/dereine)\
**Post date:** [6 October 2022 08:58 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/6 "2022-10-06T08:58:19Z")

</div>

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/6572774a6cbaadc43b9d3bc649ece92319fc187d.png)  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfb22920acbb714556c35003250a3a27c120c15d.png)

Thanks for the tip with the ui table. I think this is exactly what I need. Only I still do not know how I can display all numbers (on this day there are 19 entries) Can unfortunately not include an array there instead of the number, otherwise I would have simply created an array from this number and this then included there.  
So how can I have all the values (in this case 19 pieces) read out?  
Thanks for your help

---

<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:** [6 October 2022 09:05 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/7 "2022-10-06T09:05:37Z")

</div>

You get 1 entry because you set the payload to 1 entry of the array.

Try passing the FULL array to payload...

```auto
msg.payload = msg.payload.value
return msg

```

* * *

If necessary, you could filter out the extra properties in the array entries using `map` e.g...

```auto
msg.payload = msg.payload.value.map(e => {
  return { 
    callerNumber: e.callerNumber 
  }
})
return msg

```

---

<div class="post-metadata">

**Author:** ![dereine](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@dereine](https://discourse.nodered.org/u/dereine)\
**Post date:** [6 October 2022 09:14 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/8 "2022-10-06T09:14:58Z")

</div>

> [@Steve-Mcl](#):
>
> ```auto
> msg.payload = msg.payload.value.map(e => {
> return { 
> callerNumber: e.callerNumber 
> }
> })
> return msg
> 
> ```

Ah i understand. Thank you for your great help.  
Now it works realy good

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/9457c47acd2d7b93051e22cf34084bde5fc63d91.png)

---

<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:** [20 October 2022 09:15 UTC](https://discourse.nodered.org/t/displaying-a-list-of-numbers-from-an-array-of-objects/68388/9 "2022-10-20T09:15:24Z")

</div>

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