public AutoScalingThresholds unmarshall(JsonUnmarshallerContext context) throws Exception {
    AutoScalingThresholds autoScalingThresholds = new AutoScalingThresholds();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    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("InstanceCount", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setInstanceCount(
              IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("ThresholdsWaitTime", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setThresholdsWaitTime(
              IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("IgnoreMetricsTime", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setIgnoreMetricsTime(
              IntegerJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("CpuThreshold", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setCpuThreshold(
              DoubleJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("MemoryThreshold", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setMemoryThreshold(
              DoubleJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("LoadThreshold", targetDepth)) {
          context.nextToken();
          autoScalingThresholds.setLoadThreshold(
              DoubleJsonUnmarshaller.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 autoScalingThresholds;
  }