public DevicePoolCompatibilityResult unmarshall(JsonUnmarshallerContext context)
      throws Exception {
    DevicePoolCompatibilityResult devicePoolCompatibilityResult =
        new DevicePoolCompatibilityResult();

    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("device", targetDepth)) {
          context.nextToken();
          devicePoolCompatibilityResult.setDevice(
              DeviceJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("compatible", targetDepth)) {
          context.nextToken();
          devicePoolCompatibilityResult.setCompatible(
              context.getUnmarshaller(Boolean.class).unmarshall(context));
        }
        if (context.testExpression("incompatibilityMessages", targetDepth)) {
          context.nextToken();
          devicePoolCompatibilityResult.setIncompatibilityMessages(
              new ListUnmarshaller<IncompatibilityMessage>(
                      IncompatibilityMessageJsonUnmarshaller.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 devicePoolCompatibilityResult;
  }