问题
When I use this line I get :
AudDto[] auditDtos = objectMapper.readValue(responseBodyAsString, AudDto[].class);
I got : com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `` out of START_OBJECT token
So I add this line : objectMapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
After that I got : com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field “errMsg”
So I used : objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
Now I have no exceptions or errors, but the value that return is null.
[{"time":0,"type_key":null,"type_description":null},{"time":0,"type_key":null,"type_description":null},{"time":0,"type_key":null,"type_description":null}]
what the problem could be here ? how it can be solved ?
来源:https://stackoverflow.com/questions/65396104/mapping-json-to-array-return-null