# Send JSON to SVG node

**URL:** <https://discourse.nodered.org/t/send-json-to-svg-node/22415>\
**Category:** Dashboard\
**Created:** [29 February 2020 16:59 UTC](https://discourse.nodered.org/t/send-json-to-svg-node/22415 "2020-02-29T16:59:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [29 February 2020 16:59 UTC](https://discourse.nodered.org/t/send-json-to-svg-node/22415/1 "2020-02-29T16:59:57Z")

</div>

Hi all.  
My name is Gianluca and i'm new in this forum.  
I hope you can help me with this problem.  
I want to send JSON message to SVG node with a function or similar because i want to evaluate an input bool variable.  
Now i'm able to send message with INJECT node by selecting Payload to Json in node properties.  
This is the message:

{  
"camera": {  
"colour": "green"  
},  
"position": {  
"y\_e1": 30  
},  
"title": "New banner title by databind"  
}

---

<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:** [29 February 2020 17:15 UTC](https://discourse.nodered.org/t/send-json-to-svg-node/22415/2 "2020-02-29T17:15:05Z")

</div>

A JSON object is a string. Do you mean that you want to send a Javascript Object to the node?  
If so then have a look at the node red docs pages Working with Messages and the one on Writing Functions. If you still have problems then come back and explain what you are having difficulty with.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [29 February 2020 17:17 UTC](https://discourse.nodered.org/t/send-json-to-svg-node/22415/3 "2020-02-29T17:17:11Z")

</div>

...also have a look at this video tutorial - [https://www.youtube.com/watch?v=24ZY3CEsiow](https://www.youtube.com/watch?v=24ZY3CEsiow)

---

<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:** [29 February 2020 22:37 UTC](https://discourse.nodered.org/t/send-json-to-svg-node/22415/4 "2020-02-29T22:37:24Z")

</div>

> [@gianluca.ginoble](#):
>
> I want to send JSON message to SVG node with a function

To send JSON (or to be technically correct, a JS object) from a function to the SVG node, you simply do the following...

```auto
msg.payload = {
  property : "value",
  a_value : 42
}

// Add more properties...
msg.payload.a_new_property = 77;

return msg;

```

It would be worth your time reading up on JS objects and the node-red documentation on "working with messages"

---

<div class="post-metadata">

**Author:** ![gianluca.ginoble](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@gianluca.ginoble](https://discourse.nodered.org/u/gianluca.ginoble)\
**Post date:** [1 March 2020 15:08 UTC](https://discourse.nodered.org/t/send-json-to-svg-node/22415/5 "2020-03-01T15:08:55Z")

</div>

Thanks Paul, i've just resolved.

---

<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:** [15 March 2020 15:08 UTC](https://discourse.nodered.org/t/send-json-to-svg-node/22415/6 "2020-03-15T15:08:55Z")

</div>

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