Transform the response in NestJS using serialization

Serialization is the process of transforming data objects into a format that can be sent over a network or stored persistently, such as converting data to JSON. In this lesson, we’ll explore how to use serialization to transform the response in NestJS.

Why do we need serialization?

One common use of serialization is to control the data sent in API responses to prevent sensitive data from leaking. For example, we have a password field in the UserEntity class.

Get hands-on with 1200+ tech skills courses.