A JSON body is the data sent in the request payload formatted as JSON. It tells the server what information the client wants to send or update.
Click to reveal answer
beginner
Why do we use JSON format for request bodies in Postman?
JSON is easy to read and write, lightweight, and widely supported by APIs. It helps structure data clearly for communication between client and server.
Click to reveal answer
beginner
How do you set a JSON body in Postman?
In Postman, select the 'Body' tab, choose 'raw', then select 'JSON' from the dropdown. Then type or paste your JSON data.
Click to reveal answer
intermediate
What happens if your JSON body is not valid?
The server may reject the request with an error, or the API may not work as expected. Postman also shows an error if JSON syntax is incorrect.
Click to reveal answer
beginner
Give an example of a simple JSON body for creating a user with name and email.
{
"name": "Alice",
"email": "alice@example.com"
}
Click to reveal answer
What format should the request body be in when sending JSON data in Postman?
Araw with JSON selected
Bform-data
Cx-www-form-urlencoded
Dbinary
✗ Incorrect
To send JSON data, you must select 'raw' and then choose 'JSON' so Postman sends the data correctly.
Which of these is a valid JSON body?
A<name>Bob</name>
B{name: 'Bob', age: 30}
C{"name": "Bob", "age": 30}
Dname=Bob&age=30
✗ Incorrect
Valid JSON requires double quotes around keys and string values, like in option A.
What error might you get if your JSON body is missing a closing brace?
A401 Unauthorized
BSyntaxError or parsing error
C404 Not Found
DTimeout error
✗ Incorrect
Missing braces cause syntax errors because the JSON is not well-formed.
In Postman, where do you enter the JSON body for a POST request?
ABody tab
BHeaders tab
CParams tab
DAuthorization tab
✗ Incorrect
The Body tab is where you input the data you want to send in the request.
Why is JSON preferred over XML for API request bodies?
AJSON is heavier and slower
BJSON requires special software to read
CXML is not supported by APIs
DJSON is easier to read and write
✗ Incorrect
JSON is lightweight and easier for humans and machines to read and write compared to XML.
Explain how to create and send a JSON body in Postman for an API request.
Think about the steps in Postman interface to send JSON data.
You got /5 concepts.
Describe common errors that can happen with JSON bodies and how to avoid them.
Consider what makes JSON invalid and how Postman helps.
You got /5 concepts.
Practice
(1/5)
1. What is the correct way to represent a JSON body with a user's name and age in Postman?
easy
A. {"name": "Alice", "age": 30}
B. {name: Alice, age: 30}
C. {'name': 'Alice', 'age': 30}
D. {name = "Alice", age = 30}
Solution
Step 1: Identify JSON syntax rules
JSON keys and string values must be in double quotes. Numbers do not need quotes.
Step 2: Check each option for correct JSON format
{"name": "Alice", "age": 30} uses double quotes correctly around keys and string values. The other options use incorrect quotes or syntax.
Final Answer:
{"name": "Alice", "age": 30} -> Option A
Quick Check:
JSON keys and strings use double quotes = A [OK]
Hint: Always use double quotes for keys and string values in JSON [OK]
Common Mistakes:
Using single quotes instead of double quotes
Omitting quotes around keys
Using equal signs instead of colons
2. Which of the following is a valid JSON body to send a list of colors in Postman?
easy
A. {"colors": ("red", "green", "blue")}
B. {colors: [red, green, blue]}
C. {"colors": "red", "green", "blue"}
D. {"colors": ["red", "green", "blue"]}
Solution
Step 1: Understand JSON array syntax
Arrays in JSON are enclosed in square brackets with comma-separated values, strings in double quotes.
Step 2: Validate each option's array format
{"colors": ["red", "green", "blue"]} correctly uses square brackets and double quotes. The other options are invalid: one uses parentheses, another is missing array brackets, and one lacks quotes around strings and keys.
Final Answer:
{"colors": ["red", "green", "blue"]} -> Option D
Quick Check:
Arrays use square brackets and double quotes = B [OK]
Hint: Use square brackets for arrays and double quotes for strings [OK]