public QueryResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    QueryResult queryResult = new QueryResult();

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

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

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

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("Items", targetDepth)) {
          context.nextToken();
          queryResult.setItems(
              new ListUnmarshaller<java.util.Map<String, AttributeValue>>(
                      new MapUnmarshaller<String, AttributeValue>(
                          StringJsonUnmarshaller.getInstance(),
                          AttributeValueJsonUnmarshaller.getInstance()))
                  .unmarshall(context));
        }
        if (context.testExpression("Count", targetDepth)) {
          context.nextToken();
          queryResult.setCount(IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("ScannedCount", targetDepth)) {
          context.nextToken();
          queryResult.setScannedCount(IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("LastEvaluatedKey", targetDepth)) {
          context.nextToken();
          queryResult.setLastEvaluatedKey(
              new MapUnmarshaller<String, AttributeValue>(
                      StringJsonUnmarshaller.getInstance(),
                      AttributeValueJsonUnmarshaller.getInstance())
                  .unmarshall(context));
        }
        if (context.testExpression("ConsumedCapacity", targetDepth)) {
          context.nextToken();
          queryResult.setConsumedCapacity(
              ConsumedCapacityJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }

      token = context.nextToken();
    }

    return queryResult;
  }
  public GetItemResult unmarshall(JsonUnmarshallerContext context) throws Exception {
    GetItemResult getItemResult = new GetItemResult();

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

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

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

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("Item", targetDepth)) {
          context.nextToken();
          getItemResult.setItem(
              new MapUnmarshaller<String, AttributeValue>(
                      StringJsonUnmarshaller.getInstance(),
                      AttributeValueJsonUnmarshaller.getInstance())
                  .unmarshall(context));
        }
        if (context.testExpression("ConsumedCapacity", targetDepth)) {
          context.nextToken();
          getItemResult.setConsumedCapacity(
              ConsumedCapacityJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }

      token = context.nextToken();
    }

    return getItemResult;
  }