I have a buffer text Where I am getting from the SendGrid Inbound Parse webhook.
The Inbound Parse Webhook processes all incoming emails for a domain or subdomain, parses the contents and attachments then POSTs multipart/form-data to a URL that you choose.
The posted content is in buffer format like below
<Buffer 2d 2d 78 64 6b 69 ... >
Now I need to convert this into readable JSON format. When I tried to convert this buffer into JSON, I am getting the result like this.
var json = JSON.parse(buf);
{ type: 'Buffer', data: [ 97, 98, 99 ] }
I need to content like below example. That is the actula format.
When I tried to convert the buffer into string format, I am getting the result what I need. But, that in whole string format. I need it in JSON format. Because I need to some parameters for the responce like "From", "To" information. Is there any way to convert the buffer into readable JSON format.
Buffer -> String -> JSON
Could you please help me in converting the Buffer object to readable JSON object.