Code of UserRequest class, which contains the list of users.
public class UserRequest {
    private List<User> userList;
    public UserRequest() {
    }
    public UserRequest(List<User> userList) {
        this.userList = userList;
    }
    public List<User> getUserList() {
        return this.userList;
    }
    public void setUserList(List<User> userList) {
        this.userList = userList;
    }
}
Code of User Class, which contains the id, first name and last name of the user.
public class User {
    private String id;
    private String firstName;
    private String lastName;
    public User() {
    }
    public User(String id, String firstName, String lastName) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getLastName() {
        return lastName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
}
I am using the GSON library, and the issue that I'm having is that my json request when serializing from java objects to json is not formatted in the way I need it to be.
The format of current situation
{"userList":[{"id":"12341234", "firstName": "Joeri", "lastName": "Verlooy"}]}
The format that is desirable:
[{"id":"12341234", "firstName": "Joeri", "lastName": "Verlooy"}]
Is there a way that I can send the plain array of json object without any name?
 
     
     
    