Solution :
The problem is in the JSON - this cannot, by default, be the deserialized into the Collection
because it's not actually the JSON Array - that would look like below:
[
{
"name": "Test ordert1",
"detail": "ahk ksa"
},
{
"name": "Test ordert2",
"detail": "Fistekua"
}
]
As you are not controlling a exact process of a deserialization (RestEasy does)
The first option - would be to just inject a JSON as the String
and then take the control of a deserialization process as below:
Collection<COrder> readMyValues = new ObjectMapper().readMyValue(
jsonAsMyString, new TypeReference<Collection<COrder>>() { }
);
You would loose the bit of a convenience of not having to do that by yourself, but you would easily sort out a problem.
Second option - If you cannot change a JSON - would be to construct the wrapper to fit a structure of the JSON input - and use that instead of the Collection<COrder>
.