Make Selenium Easy

REST Assured Tutorial 30 – How To Create POJO Classes Of A JSON Array Payload

As a part of End to End REST Assured Tutorial , in this post We will learn to create a simple POJO class for a simple JSON Array payload. In previous post we have learnt about How to create POJO classes of a JSON Object Payload.

If you are not aware of JSON Array then please refer Introduction to JSON here.

We will take similar JSON object payload as previous post but this time it will be multiple JSON Objects in a JSON Array.

Sample JSON Array Payload

Above JSON Array is a collection of JSON Objects or a List of Employees. We have created a Employee POJO class in previous post and we can reuse the same. That is how reusability is one of the major advantage of POJO classes.

Employee POJO

We do not need any other classes. We just need to create a List of Employees . Below code snippets shows how can we convert a Java Object in to a JSON Array and vice versa.

Output

You can download/clone above sample project from here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyLearning

Find all Selenium related post here, all API manual and automation related posts here and find frequently asked Java Programs here.

Many other topics you can navigate through menu.

Author: Amod Mahajan

A software Tester who is paid to judge products developed by others. Currently getting paid in American Dollars. Writing technical posts and creating YouTube videos are my hobbies.

1 thought on “REST Assured Tutorial 30 – How To Create POJO Classes Of A JSON Array Payload

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.

REST Assured Tutorial 30 – How To Create POJO Classes Of A JSON Array Payload

by Amod Mahajan time to read: 3 min
1
%d bloggers like this: