I'm trying to map a json object from my dynamodb table using DynamoDbMapper and with the latest aws android sdk: com.amazonaws:aws-android-sdk-ddb-mapper:2.13.0, I'm seeing this exception: "DynamoDBMappingException: Expected S in value...
The json object in my table has 3 attributes, 2 of which are string and the third is a list of complex objects. I've created an object using the @DynamoDbDocument annotation for the complex object and used the proper marshaling annotation but it doesn't seem to be unmarshaling the json object into a java object correctly. The complex object is a json object in this format:
{
  "allCitiesList": [
    {
      "city": "Auckland, New Zealand",
      "times": {
        "recTimes": [
          "Jan1",
          "Jan2"
        ]
      }
    }
}
public class CitiesDO {
    private String city;
    private String country;
    private List<AllCitiesObject> allCitiesList;
...get/setters for other fields...
    @DynamoDBMarshalling(marshallerClass = 
    AllCitiesJSONMarshaller.class)
    public List<AllCitiesObject> getAllCitiesList() {
        return allCitiesList;
    }
    public void setAllCitiesList(List<AllCitiesObject> allCitiesList) {
        this.allCitiesList = allCitiesList;
    }
}
@DynamoDBDocument
public class AllCitiesObject {
    @DynamoDBAttribute(attributeName = "allCitiesList")
    private String data;
    public AllCitiesObject(){}
    public String getData() {
        return data.toString();
    }
    public void setData(String data) {
        this.data = data;
    }
}
class AllCitiesJSONMarshaller extends JsonMarshaller<AllCitiesObject> {}
Have also tried this approach with a custom marshaller but no success:
public class MyCustomMarshaller implements DynamoDBMarshaller<List<AllCitiesObject>> {
    private static final ObjectMapper mapper = new ObjectMapper();
    private static final ObjectWriter writer = mapper.writer();
    @Override
    public String marshall(List<AllCitiesObject> obj) {
        try {
            return writer.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            throw new RuntimeException(
                    "Unable to marshall the instance of " + obj.getClass()
                            + "into a string", e);
        }
    }
    @Override
    public List<AllCitiesObject> unmarshall(Class<List<AllCitiesObject>> clazz, String json) {
        final CollectionType
                type =
                mapper.getTypeFactory().constructCollectionType(List.class, AllCitiesObject.class);
        try {
            return mapper.readValue(json, type);
        } catch (Exception e) {
            throw new RuntimeException("Unable to unmarshall the string " + json
                    + "into " + clazz, e);
        }
    }
}
The exception is: DynamoDBMappingException: Expected S in value {L: [{M: {times={M: {recTimes={L: [{S: Jan1,}, {S: Jan2,}
I'm having difficulty unmarshalling the json to a string although I think I have it set up correctly. Can anyone please help me understand what I'm missing and how to approach this issue? I would really appreciate your help!
 
    