Book Image

Building a RESTful Web Service with Spring

By : Ludovic Dewailly
Book Image

Building a RESTful Web Service with Spring

By: Ludovic Dewailly

Overview of this book

Table of Contents (17 chapters)
Building a RESTful Web Service with Spring
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 4. Data Representation

We looked at how to build a RESTful endpoint in the previous chapter. We also briefly discussed how the data is represented in REST responses. In this chapter, we will expand on these discussions and cover the following topics:

  • The Data-Transfer-Object design pattern

  • Controlling the responses format in JSON

  • Tips on formatting responses

  • API evolutions

Before we delve into the specifics of how to control our JSON responses, let's first take a look at the DTO design pattern.