0
0
PostmanHow-ToBeginner ยท 3 min read

How to Send JSON Body in Postman: Step-by-Step Guide

To send a JSON body in Postman, select POST or another method that supports a body, go to the Body tab, choose raw, and select JSON from the dropdown. Then, enter your JSON data in the text area and send the request.
๐Ÿ“

Syntax

In Postman, sending a JSON body involves setting the HTTP method, selecting the body type, and specifying the JSON content.

  • HTTP Method: Usually POST, PUT, or PATCH for sending data.
  • Headers: Set Content-Type to application/json to tell the server you are sending JSON.
  • Body: Choose raw and select JSON format, then enter your JSON data.
http
POST /api/example HTTP/1.1
Host: example.com
Content-Type: application/json

{
  "key": "value",
  "number": 123
}
๐Ÿ’ป

Example

This example shows how to send a JSON body with a POST request in Postman to create a new user with a name and email.

json
{
  "name": "Alice",
  "email": "alice@example.com"
}
Output
HTTP/1.1 201 Created { "id": "123", "name": "Alice", "email": "alice@example.com" }
โš ๏ธ

Common Pitfalls

Common mistakes when sending JSON in Postman include:

  • Not setting Content-Type header to application/json, causing the server to reject the data.
  • Entering invalid JSON syntax, such as missing quotes or commas.
  • Choosing the wrong body type (e.g., form-data instead of raw).

Always validate your JSON before sending.

json
Wrong way:
{
  "name": "Alice",
  "email": "alice@example.com"
}

Right way:
{
  "name": "Alice",
  "email": "alice@example.com"
}
๐Ÿ“Š

Quick Reference

StepAction
1Select HTTP method (POST, PUT, PATCH)
2Go to Body tab and select raw
3Choose JSON from the dropdown menu
4Enter valid JSON data in the text area
5Ensure Content-Type header is application/json
6Click Send to execute the request
โœ…

Key Takeaways

Always select raw body and JSON format to send JSON data in Postman.
Set the Content-Type header to application/json to inform the server.
Validate your JSON syntax to avoid errors.
Use POST, PUT, or PATCH methods when sending JSON bodies.
Check the server response to confirm your JSON was received correctly.