I created a simple web service which consists of a Person class containing a List of Car classes.
Person class:
Car class:
Created a different object to store my inquries.
Here's my actual client (a Jersey based Restful Web Service):
When I call the getPerson() method as follows:
It returns a 201 containing this JSON Object (which is what I want):
However, when I call the getCar method() as follows:
I get the following JSON object (with the second item in the ArrayList being added!):
I wanted it to be Toyota instead of Ford.
If you can tell, I printed out the value of the car.getMake()
String and inside the console / shell, it ways says this:
car.getMake(): Toyota
car.getMake(): Ford
So, it seems that its iterating through the list but adding the last item (or just next item)??
What am I possibly doing wrong? Thank you for taking the time to read this...