# Buffer Parser to JSON to PUSH & REST API

**URL:** <https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940>\
**Category:** General\
**Created:** [15 November 2020 04:42 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940 "2020-11-15T04:42:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![maa1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@maa1](https://discourse.nodered.org/u/maa1)\
**Post date:** [15 November 2020 04:42 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/1 "2020-11-15T04:42:36Z")

</div>

Hi,

I want to know:

1. How I can convert the output of Buffer Parser into JSON?
2. How to send the JSON data over PUSH API and REST API.

Please help.

---

<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:** [15 November 2020 08:09 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/2 "2020-11-15T08:09:58Z")

</div>

For 1. Assuming that the output is a JavaScript Object in `msg.payload` then feed it through a JSON node and it will convert it into a JSON string.

For 2. Start by looking at the examples in the node red cookbook.

---

<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:** [15 November 2020 09:03 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/3 "2020-11-15T09:03:41Z")

</div>

This is not really a buffer parser question. You should really title this how to convert js object to JSON and transmit to REST API.

As @Colin said, send your js object through a JSON node to convert it into JSON however, I am fairly certain you can simply pass the object to the http request node. Have you tried?

---

<div class="post-metadata">

**Author:** ![maa1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@maa1](https://discourse.nodered.org/u/maa1)\
**Post date:** [17 November 2020 07:41 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/4 "2020-11-17T07:41:28Z")

</div>

@Steve-Mcl & @Colin

I'm sending the data output of Buffer Parser to PUSH API and in order to send the data, I need to convert it into JSON format so I wrote Buffer Parser to JSON to PUSH & REST API.

Currently, I'm getting status code 400 on HTTP node while sending the data directly from Buffer Parser and/ or after using JSON Parser. I've configured API URL in HTTP node and method as POST.

Please help.

---

<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:** [17 November 2020 08:10 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/5 "2020-11-17T08:10:35Z")

</div>

> [@maa1](#):
>
> Currently, I'm getting status code 400 on HTTP node while sending the data directly from Buffer Parser and/ or after using JSON Parser. I've configured API URL in HTTP node and method as POST.

Unless the API is public, there is no way to help you as you have provided too little information.

I would suggest start simple use basic inject / change / function nodes and attempt to make a simple POST using HTTP Request. Once you have a simple one working, then change the payload to use your real data.

If necessary, work through the [cookbook examples](https://cookbook.nodered.org/#http-requests)

---

<div class="post-metadata">

**Author:** ![maa1](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@maa1](https://discourse.nodered.org/u/maa1)\
**Post date:** [24 November 2020 06:52 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/6 "2020-11-24T06:52:19Z")

</div>

@Steve-Mcl,

Hi,

How do I verify that data is flowing to API?

---

<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:** [24 November 2020 08:18 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/7 "2020-11-24T08:18:23Z")

</div>

> [@maa1](#):
>
> How do I verify that data is flowing to API?

If you own the API, check it is logging connections and commands.

If you know who owns the API, ask them to check.

If you get data or a negative response from the API, it is working.

If you have none of the above, you cannot 100% verify.

You can - emulate the API and test to the emulated API.

You can use wireshark to see data going out of your node-red.

---

<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:** [23 January 2021 08:18 UTC](https://discourse.nodered.org/t/buffer-parser-to-json-to-push-rest-api/35940/8 "2021-01-23T08:18:25Z")

</div>

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