Categories
JavaScript Answers

How to return a complex JSON response with Node.js?

Spread the love

To return a complex JSON response with Node.js, we call the res.json method.

For instance, we write

res.json({ msgId: msg.fileName });

to call res.json to return the object as the response body.

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 *