title: DynamoDB Storing/ Mapping Complex Objects in Maps
body: <p>We are trying to get started with dynamo db and I'm breaking my head over a mapping problem.</p>
  
  <p>I have a model Match and matchPlayer.</p>
  
  <p>Match has a map property which contains matchPlayer objects.</p>
  
  <p>I can't get dynamodb to correctly map this property.
  I tried the json Marshaller but that just results into an error</p>
  
  <p>Expected S in value {M: {player2={M:(More json)</p>
  
  <p>Are there any good examples or tutorials for mapping/ marshalling a map with complex objects to work with dynamodb? I found tutorials for working with simple complex objects but not with a map of objects.</p>
  
  <p>I'm glad for any help!</p>
  
  <pre><code>@DynamoDBTable(tableName="Matches")
  public class Match {
  
      private String matchId;
      private Boolean active;
      private int currentRound;
      private Boolean finished;
  
      private Map&lt;String, MatchPlayers&gt; players;
  
      @DynamoDBHashKey(attributeName = "matchId")
      public String getMatchId() {
          return matchId;
      }
  
      public void setMatchId(String matchId) {
          this.matchId = matchId;
      }
      @DynamoDBIndexRangeKey(attributeName = "active")
      public Boolean getActive() {
          return active;
      }
  
      public void setActive(Boolean active) {
          this.active = active;
      }
  
  
      @DynamoDBIndexRangeKey(attributeName = "currentRound")
      public int getCurrentRound() {
          return currentRound;
      }
  
      public void setCurrentRound(int currentRound) {
          this.currentRound = currentRound;
      }
  
      @DynamoDBIndexRangeKey(attributeName = "finished")
      public Boolean getFinished() {
          return finished;
      }
  
      public void setFinished(Boolean finished) {
          this.finished = finished;
      }
  
      @DynamoDBMarshalling(marshallerClass = MatchPlayersMarshaller.class)
      @DynamoDBIndexRangeKey(attributeName = "players")
      public Map&lt;String, MatchPlayers&gt; getPlayers() {
          return players;
      }
  
      public void setPlayers(Map&lt;String, MatchPlayers&gt; players) {
          this.players = players;
      }
  }
  </code></pre>