Categories
JavaScript Answers

How to pass JSON to HTTP POST Request with JavaScript?

Spread the love

To pass JSON to HTTP POST Request with JavaScript, we call request with an object with the json property.

For instance, we write

request({
  url,
  method: "POST",
  json: requestData,
});

to call request to make a post request to the url.

We set json to requestData JSON string to send the JSON.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *