public Command unmarshall(JsonUnmarshallerContext context) throws Exception {
    Command command = new Command();

    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("Name", targetDepth)) {
          context.nextToken();
          command.setName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("ScriptPath", targetDepth)) {
          context.nextToken();
          command.setScriptPath(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Args", targetDepth)) {
          command.setArgs(
              new ListUnmarshaller<String>(StringJsonUnmarshaller.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 command;
  }
  public Command unmarshall(JsonUnmarshallerContext context) throws Exception {
    Command command = new Command();

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

    JsonToken token = context.getCurrentToken();
    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("CommandId", targetDepth)) {
          context.nextToken();
          command.setCommandId(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("DocumentName", targetDepth)) {
          context.nextToken();
          command.setDocumentName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Comment", targetDepth)) {
          context.nextToken();
          command.setComment(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("ExpiresAfter", targetDepth)) {
          context.nextToken();
          command.setExpiresAfter(DateJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Parameters", targetDepth)) {
          context.nextToken();
          command.setParameters(
              new MapUnmarshaller<String, java.util.List<String>>(
                      StringJsonUnmarshaller.getInstance(),
                      new ListUnmarshaller<String>(StringJsonUnmarshaller.getInstance()))
                  .unmarshall(context));
        }
        if (context.testExpression("InstanceIds", targetDepth)) {
          context.nextToken();
          command.setInstanceIds(
              new ListUnmarshaller<String>(StringJsonUnmarshaller.getInstance())
                  .unmarshall(context));
        }
        if (context.testExpression("RequestedDateTime", targetDepth)) {
          context.nextToken();
          command.setRequestedDateTime(DateJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Status", targetDepth)) {
          context.nextToken();
          command.setStatus(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("OutputS3BucketName", targetDepth)) {
          context.nextToken();
          command.setOutputS3BucketName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("OutputS3KeyPrefix", targetDepth)) {
          context.nextToken();
          command.setOutputS3KeyPrefix(StringJsonUnmarshaller.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 command;
  }