# Working with JSON or XML v2

**URL:** <https://discourse.nodered.org/t/working-with-json-or-xml-v2/57635>\
**Category:** General\
**Created:** [2 February 2022 11:37 UTC](https://discourse.nodered.org/t/working-with-json-or-xml-v2/57635 "2022-02-02T11:37:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@brian](https://discourse.nodered.org/u/brian)\
**Post date:** [2 February 2022 11:37 UTC](https://discourse.nodered.org/t/working-with-json-or-xml-v2/57635/1 "2022-02-02T11:37:51Z")

</div>

hello agian

the last tread got closed.

> [@Working with JSON or XML](https://discourse.nodered.org/t/working-with-json-or-xml/53059):
>
> Hi all A noob question I have this unit that sends a JSON or XML file to a server which works fine (but a somewhat pricey solution) . i would like to make a more simpel solution to this using node red. I know that it should work but i just need a direktion how to parse the file and send a response back to the unit. any help would be appreciated The JSON file structure: { "Monitor": { "DeviceInfo": { "DeviceName": "TCG120", "HostName": "TCG120", "ID": "863071015406348", "FwVer": "v2.…

i got the unit to upload the file xml to a server, and i can read the file.  
But can i send it directly in to node red, instead read a file on a server?  
This is the unit that i am trying the connect to and control.

> **[tcg120-gsm-gprs-remote-monitoring-user-manual-r1.16.pdf](https://www.teracomsystems.com/wp-content/uploads/tcg120/tcg120-gsm-gprs-remote-monitoring-user-manual-r1.16.pdf)**

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [2 February 2022 15:21 UTC](https://discourse.nodered.org/t/working-with-json-or-xml-v2/57635/2 "2022-02-02T15:21:59Z")

</div>

You may be able to, depending on how Node-RED is configured and how accessible it is. Whether you _should_ may be another matter. But that is up to how secure you want things and how you have configured node-red.

---

<div class="post-metadata">

**Author:** ![brian](https://avatars.discourse-cdn.com/v4/letter/b/97f17d/32.png) [@brian](https://discourse.nodered.org/u/brian)\
**Post date:** [4 February 2022 06:57 UTC](https://discourse.nodered.org/t/working-with-json-or-xml-v2/57635/3 "2022-02-04T06:57:19Z")

</div>

The node red installation is exposed on high port number, and behind a DPI firewall with access log.  
Right now, the xml is sitting a open web server for test purposes.

I having trouble understanding which nod i should use for end point and how is i differentiate between the different units that are sending the file.  
All in all, i have about 15 units.

the configuration pages looks like this on the unit:

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [4 February 2022 09:25 UTC](https://discourse.nodered.org/t/working-with-json-or-xml-v2/57635/4 "2022-02-04T09:25:08Z")

</div>

You need a combination of an http-in and http-out node. The -in node must listen for POST requests and the -out must send a simple response back so that the sending app knows that it has succeeded.

If the JSON data contains an identifier for the unit then you just need to process that in the flow. If not, then you need to set the URL for the -in node to have something like `/:unit` on the end and use a unique URL in each post page that ends in the unit id.

`http://<node-red-address>:<port>/<http-in-url>/<unit>`

---

<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:** [5 April 2022 09:25 UTC](https://discourse.nodered.org/t/working-with-json-or-xml-v2/57635/5 "2022-04-05T09:25:11Z")

</div>

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