I'm having trouble converting a List object and it's returning the error below:
expected S in value {L: [{M: {txt_just={S: new client,}, num_funl={S: 123,}, num_propt={S: 2f1a8e6c-68bb-4c26-9326-3823d9f96c4c,}, ind_decs={S: S,}, dat_hor={S: 20220721183000,}},}],}
My Class translator:
public class ObjectTranslators<T> implements DynamoDBTypeConverter<String, T> {
private static final ObjectMapper mapper = new ObjectMapper();
@Override
public String convert(T t) {
try {
return mapper.writeValueAsString(t);
} catch (JsonProcessingException e) {
throw new IllegalArgumentException("Unable to parse JSON");
}
}
@Override
public T unconvert(String s) {
try {
return mapper.readValue(s, new TypeReference<>() {});
} catch (IOException e) {
throw new IllegalArgumentException("Unable to read JSON");
}
}
}
CodePudding user response:
You are trying to convert a List that has a single entry which is a Map of 5 key/value pairs. Your real issue is probably that there is no value supplied to ind_decs
but, it's also possible that you aren't properly using the expected generic T type wherever ObjectTranslators is used as well.
expected S in value
{
L: [
{
M: {
txt_just={S: new client,},
num_funl={S: 123,},
num_propt={S: 2f1a8e6c-68bb-4c26-9326-3823d9f96c4c,},
ind_decs={S: S,},
dat_hor={S: 20220721183000,}
},
}
],
}