Reputation: 658
I am trying to pass entire payload to my java class . This is my payload .
[
{
"op": "replace",
"path": "baseLoanAmount",
"value": "10000.00"
}
]
This is my java class
public void test(Object payload) {
System.out.println("Inside Test ******** "+payload);
}
In invoke i am calling the method like test(Object) and passing payload as argument. But i am getting an error saying Cannot coerce array to object . How i can pass it ?
Upvotes: 0
Views: 723
Reputation: 25837
The error makes sense, because the parameter is an Object and the argument is an array. Try making the parameter an array, for example test(Object[] payload)
.
Upvotes: 1