# PLC, json get and post

**URL:** <https://discourse.nodered.org/t/plc-json-get-and-post/9662>\
**Category:** General\
**Created:** [1 April 2019 14:50 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662 "2019-04-01T14:50:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALeman](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@ALeman](https://discourse.nodered.org/u/ALeman)\
**Post date:** [1 April 2019 14:50 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662/1 "2019-04-01T14:50:51Z")

</div>

Hey,

I'm new to Node-RED. My goal is to communicate between a webservice and a PLC. I have been succesful in putting data into the PLC. The post will be a bunch of parameters to be stored in the PLC.

Any suggestions on how to go about seperating the values. So that i can send these values to the PLC.

For example:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/8/8233b79dc053039958ad21eebd14108bf504f9ad.png)

As a plc-programmer I am not that familiar with json code.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [1 April 2019 15:00 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662/2 "2019-04-01T15:00:47Z")

</div>

That doesn't look like JSON, so how are you getting these values into Node-RED?  
If it's as a single text string then theres the javascript split command or you could try the csv node.

There's a handy page in the docs that explains about using the debug panel to identify the right path to items [https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)

It would also be worth reading one of the online tutorials on Javascript Objects and Arrays ( eg w3schools) as its fundamental to manipulating data in Node-RED

---

<div class="post-metadata">

**Author:** ![ALeman](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@ALeman](https://discourse.nodered.org/u/ALeman)\
**Post date:** [2 April 2019 07:34 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662/3 "2019-04-02T07:34:24Z")

</div>

The code in the string from the JSON get will look like this,

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f344a0cae4e3d1cd93c4ddc89dc74729b6b9bb62.png)

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 April 2019 07:37 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662/4 "2019-04-02T07:37:16Z")

</div>

and if you send it to the debug panel using a debug node the page I linked to will explain how to get the path to specific items.

But please read an online tutorial about javascript objects and arrays, it’s time well spent.

---

<div class="post-metadata">

**Author:** ![ALeman](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@ALeman](https://discourse.nodered.org/u/ALeman)\
**Post date:** [2 April 2019 07:38 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662/5 "2019-04-02T07:38:53Z")

</div>

I will try this out! Thanks for the help

---

<div class="post-metadata">

**Author:** ![seth350](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seth350/32/4617_2.png) [@seth350](https://discourse.nodered.org/u/seth350)\
**Post date:** [3 April 2019 02:44 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662/6 "2019-04-03T02:44:21Z")

</div>

A side question, if I may, what PLC are your using?

---

<div class="post-metadata">

**Author:** ![ALeman](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@ALeman](https://discourse.nodered.org/u/ALeman)\
**Post date:** [3 April 2019 06:30 UTC](https://discourse.nodered.org/t/plc-json-get-and-post/9662/7 "2019-04-03T06:30:57Z")

</div>

Thanks ukmoose for the advice. It has worked.

It has worked with a Siemens 300 and 1500 series.
