Having a standard data format for responses is one of the key points for ensuring web service stability. In this chapter, we will introduce content negotiation, output formats, and the HAL JSON format to explain stateless API conventions. In the Data serialization section, you will learn how to convert resource objects into JSON objects or JSON arrays. Since JSON has become a standard, we will mainly focus on that format. We will also talk about how to expose data as XML files.
The following topics will be covered in this chapter:
- Content negotiation
- Data serialization
- Other output types