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

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

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
0
%d bloggers like this: