Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Sending JSON Responses | Section
Building APIs with Express.js

bookSending JSON Responses

Swipe to show menu

In backend development, data is usually sent in JSON format.

JSON is a structured way to represent data. It looks like a JavaScript object but is used for communication between systems.

In Express, you can send JSON using res.json():

app.get('/user', (req, res) => {
  res.json({
    name: 'John',
    age: 25
  });
});

This sends a structured response that can be easily used by the frontend.

JSON is commonly used because it is simple, readable, and supported by all modern applications.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 6

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 1. Chapter 6
some-alt