public Object unwrap(Object o) {

    if (o == null) {
      return null;
    }
    if (!(o instanceof JsonNode)) {
      return o;
    }

    JsonNode e = (JsonNode) o;

    if (e.isValueNode()) {

      if (e.isTextual()) {
        return e.asText();
      } else if (e.isBoolean()) {
        return e.asBoolean();
      } else if (e.isInt()) {
        return e.asInt();
      } else if (e.isLong()) {
        return e.asLong();
      } else if (e.isBigDecimal()) {
        return e.decimalValue();
      } else if (e.isDouble()) {
        return e.doubleValue();
      } else if (e.isFloat()) {
        return e.floatValue();
      } else if (e.isBigDecimal()) {
        return e.decimalValue();
      } else if (e.isNull()) {
        return null;
      }
    }
    return o;
  }