# Use msg.payload.data in template inside \<script\> tag

**URL:** <https://discourse.nodered.org/t/use-msg-payload-data-in-template-inside-script-tag/80204>\
**Category:** General\
**Created:** [1 August 2023 07:43 UTC](https://discourse.nodered.org/t/use-msg-payload-data-in-template-inside-script-tag/80204 "2023-08-01T07:43:10Z")\
**Posts on this page:** 1\
**Showing post:** 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:** [1 August 2023 08:26 UTC](https://discourse.nodered.org/t/use-msg-payload-data-in-template-inside-script-tag/80204/3 "2023-08-01T08:26:55Z")

</div>

> [@Hans4711](#):
>
> Looks like simple {{msg.payload.data[0]}} will not work

If it is the regular template (the orange node), then no, that wont work.

But the answer is on the forum - [hundreds of times](https://discourse.nodered.org/search?q=mustache%20array) and in the mustache docs

In short, `{{payload.data.0}}`

* * *

If on the otherhand, you are refering to the ui-template node (the light blue node), then the built in help tells you to use `scope` and `watch`

Tons of examples on the forum too:

- [Ui-template: sending msg through a function - #4 by Steve-Mcl](https://discourse.nodered.org/t/ui-template-sending-msg-through-a-function/59686/4)
- [Gauge.js library & Node-Red - #2 by Steve-Mcl](https://discourse.nodered.org/t/gauge-js-library-node-red/49449/2)
- [2 questions in one post:) - ui messages and code - #7 by Steve-Mcl](https://discourse.nodered.org/t/2-questions-in-one-post-ui-messages-and-code/49875/7)

---

_[View the full topic](https://discourse.nodered.org/t/use-msg-payload-data-in-template-inside-script-tag/80204)._
