0
0
Postmantesting~5 mins

JSON body in Postman

Choose your learning style9 modes available
Introduction

A JSON body is used to send data in a structured way when testing APIs. It helps the server understand what information you want to send.

When you want to send user details like name and email to a server.
When testing login functionality by sending username and password.
When creating or updating data on a server through an API.
When you need to send multiple pieces of related information in one request.
Syntax
Postman
{
  "key1": "value1",
  "key2": 123,
  "key3": true
}

Keys and string values must be in double quotes.

Values can be strings, numbers, booleans, arrays, or other JSON objects.

Examples
Simple JSON body with username and password as strings.
Postman
{
  "username": "john_doe",
  "password": "12345"
}
JSON body with a number and a boolean value.
Postman
{
  "id": 101,
  "active": true
}
JSON body with an array of strings.
Postman
{
  "items": ["apple", "banana", "cherry"]
}
Sample Program

This JSON body can be used in Postman to send user information to an API.

Postman
{
  "firstName": "Alice",
  "lastName": "Smith",
  "age": 30,
  "email": "alice@example.com"
}
OutputSuccess
Important Notes

Always check that your JSON is valid before sending it in Postman.

Use online JSON validators or Postman's built-in validation to avoid errors.

Remember that JSON keys are case-sensitive.

Summary

JSON body is a way to send structured data in API testing.

It uses key-value pairs with keys and string values in double quotes.

JSON can include strings, numbers, booleans, arrays, and nested objects.