Rest API receive array

Hello All,

If I need to send a array of objects to Cuba Rest API, how should my service method signature look? So from JS, if I am sending an array like this after JSON Stringify, how will my Java method signature look.

let cars = [
{
“color”: “purple”,
“type”: “minivan”,
“registration”:‘2017-01-03’,
“capacity”: 7
},
{
“color”: “red”,
“type”: “station wagon”,
“registration”: ‘2018-03-03’,
“capacity”: 5
},
{

},

]

Regards,
Prashanth

Hi,
I think List<Car> cars as an argument of the java service method should work. Did you try it?

Thanks @gorbunkov.
Here is what I did. It might help some one.
I Stringified the object in JS. So in Cuba I could get as string itself.
public BigDecimal GetCarDetails2(String carStructure) {

Gson gson = new Gson();

Type collectionType = new TypeToken<Collection>(){}.getType();

Collection carList = gson.fromJson(carStructure, collectionType);
}