# Pass topic to JSON data

**URL:** <https://discourse.nodered.org/t/pass-topic-to-json-data/59683>\
**Category:** General\
**Created:** [10 March 2022 22:17 UTC](https://discourse.nodered.org/t/pass-topic-to-json-data/59683 "2022-03-10T22:17:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CAL37](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@CAL37](https://discourse.nodered.org/u/CAL37)\
**Post date:** [10 March 2022 22:17 UTC](https://discourse.nodered.org/t/pass-topic-to-json-data/59683/1 "2022-03-10T22:17:13Z")

</div>

I created this flow so I could turn on the TV/change source between Hulu and Netflix using Alexa. I have the topic defined in the Alexa nodes and I can see the topic is being passed all the way to the call service node, but I don't know how to get it into the JSON data field to change the source. I was thinking I could put {{topic}}, but that is not working. What am I doing wrong?

```auto
{
"source": "{{topic}}"
}

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e0f5f7d275baa002ac86639395c490b80b0f6d39.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/3/73ec0afeaa1bf7995b1b40039e608ff0038440b3.png)

---

<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:** [10 March 2022 22:45 UTC](https://discourse.nodered.org/t/pass-topic-to-json-data/59683/2 "2022-03-10T22:45:08Z")

</div>

You are using JSONata not JSON.  
What you are trying should work if you select JSON.  
Or the J: expression would be  
`{"source": $$.topic}`

---

<div class="post-metadata">

**Author:** ![CAL37](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@CAL37](https://discourse.nodered.org/u/CAL37)\
**Post date:** [11 March 2022 13:30 UTC](https://discourse.nodered.org/t/pass-topic-to-json-data/59683/3 "2022-03-11T13:30:35Z")

</div>

@E1cid I did not know there was a difference and just use the default J: expression. Thank you for your help!

---

<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:** [25 March 2022 13:31 UTC](https://discourse.nodered.org/t/pass-topic-to-json-data/59683/4 "2022-03-25T13:31:33Z")

</div>

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