Rest Assured API Testing Tutorial | Serialization and Deserialization in RestAssured

βœ… What you are going to learn?

  1. Create your own rest assured pojo. β€”
  2. What is serialization?
  3. What is deserialization?
  4. Example of Serialization and Deserialization Objects in RestAssured
  5. How to serialize an object?
  6. How to deserialize into the object?
  7. Example of rest assured deserialize list and normally rest assured deserialize json array

What is Serialization?

  • Serialization is the process of converting objects into a stream of data.
  • The serialization and deserialization process is platform-independent, it means you can serialize an object in a platform and deserialize in different platform.

βœ… How to Serialize an object?

  • Data that is exchanged between client and server is of JSON format.
  • Serialize objects into a stream of JSON data and deserialize stream of data to objects that are exchanged between the REST web service.

βœ… What is Deserialization?

Deserialization is the process of converting a stream of data into objects.
The main purpose of serialization and deserialization is to persist the data and recreate whenever needed.

βœ… How to deserialize into the object?

  • Rest Assured can use the Jackson 2 library, GSON library or Jackson library for serialization and deserialization.
  • Jackson 2 library for serialization and deserialization purposes.

βœ… REST Assured ObjectMapper Serialization with JSON

Often when you are using REST Assured, you will want to serialize a POJO (Plain old Java Object) and send that in your API call. Or you might want to take the API response and de-serialize the body to a POJO.

βœ… JSON Serialization & JSON De-Serialization

JSON is a format that encodes objects in a string. Serialization means to convert an object into that string, and deserialization is its inverse operation (convert string to object)

βœ… What is REST Assured?

REST Assured is a Java library that provides a domain-specific language (DSL) for writing powerful, maintainable tests for RESTful APIs. … I’ll be using real-world code examples you can copy, run, and reuse directly in your own test automation effort



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store