# Create array without writing functions

**URL:** <https://discourse.nodered.org/t/create-array-without-writing-functions/27926>\
**Category:** General\
**Created:** [7 June 2020 06:02 UTC](https://discourse.nodered.org/t/create-array-without-writing-functions/27926 "2020-06-07T06:02:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wakeup](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@wakeup](https://discourse.nodered.org/u/wakeup)\
**Post date:** [7 June 2020 06:02 UTC](https://discourse.nodered.org/t/create-array-without-writing-functions/27926/1 "2020-06-07T06:02:38Z")

</div>

I know how to create an array with a function, but how can I inject directly an array?

Can I create an array with number injection and another predefined node without writing a function?

Thanks

---

<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:** [7 June 2020 06:48 UTC](https://discourse.nodered.org/t/create-array-without-writing-functions/27926/2 "2020-06-07T06:48:59Z")

</div>

Hi welcome to node-red

You can use an inject node to make an array or a change node (set for json or Jsonata)

You can also use a template node.

Give it a try.

---

<div class="post-metadata">

**Author:** ![wakeup](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@wakeup](https://discourse.nodered.org/u/wakeup)\
**Post date:** [7 June 2020 07:04 UTC](https://discourse.nodered.org/t/create-array-without-writing-functions/27926/3 "2020-06-07T07:04:41Z")

</div>

thanks a lot.  
If I have 3 responses of 3 nodes. Can I convert in an array of 3 positions without write my own function?

---

<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:** [7 June 2020 07:13 UTC](https://discourse.nodered.org/t/create-array-without-writing-functions/27926/4 "2020-06-07T07:13:56Z")

</div>

Join node can take 3 messages and generate an object then you could use change node and JSONata

Question. Why the aversion to function nodes?

Sometimes, a function node is the right thing to do (can be the difference between a single node Vs sprawling spaghetti hell / incomprehensible JSONata)

Its not difficult to work with arrays in a function node and there are many who can help when you need it.

**Edit**..., the join node might even be able to make an array from your messages (I can't remember it's capabilities of the top of my head)

---

<div class="post-metadata">

**Author:** ![wakeup](https://avatars.discourse-cdn.com/v4/letter/w/c6cbf5/32.png) [@wakeup](https://discourse.nodered.org/u/wakeup)\
**Post date:** [8 June 2020 04:56 UTC](https://discourse.nodered.org/t/create-array-without-writing-functions/27926/5 "2020-06-08T04:56:17Z")

</div>

Thanks. You are right with the funcions. But first I would know how to do things without them.

---

<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:** [22 June 2020 04:56 UTC](https://discourse.nodered.org/t/create-array-without-writing-functions/27926/6 "2020-06-22T04:56:19Z")

</div>

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