public Key unmarshall(JsonUnmarshallerContext context) throws Exception {
    Key key = new Key();

    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("HashKeyElement", targetDepth)) {
          context.nextToken();
          key.setHashKeyElement(AttributeValueJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("RangeKeyElement", targetDepth)) {
          context.nextToken();
          key.setRangeKeyElement(AttributeValueJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getCurrentDepth() <= originalDepth) break;
      }
      token = context.nextToken();
    }

    return key;
  }
  public PutItemResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    PutItemResult putItemResult = new PutItemResult();

    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("Attributes", targetDepth)) {
          putItemResult.setAttributes(
              new MapUnmarshaller<String, AttributeValue>(
                      StringJsonUnmarshaller.getInstance(),
                      AttributeValueJsonUnmarshaller.getInstance())
                  .unmarshall(context));
        }
        if (context.testExpression("ConsumedCapacityUnits", targetDepth)) {
          context.nextToken();
          putItemResult.setConsumedCapacityUnits(
              DoubleJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getCurrentDepth() <= originalDepth) break;
      }
      token = context.nextToken();
    }

    return putItemResult;
  }