public static JsonValue removePaths(JsonValue jsonValue, Paths paths, Paths pathsToIgnore) {
    if (paths.matches(pathsToIgnore)) return JsonValue.NULL;

    if (jsonValue.isObject()) {
      paths = new Paths(paths);
      paths.extend("{}");

      if (paths.matches(pathsToIgnore)) return JsonValue.NULL;

      JsonObject jsonObject = new JsonObject();
      for (String name : jsonValue.asObject().names()) {
        Paths currentPaths = new Paths(paths);
        currentPaths.extend(name);
        jsonObject.set(
            name, removePaths(jsonValue.asObject().get(name), currentPaths, pathsToIgnore));
      }
      return jsonObject;
    }
    if (jsonValue.isArray()) {
      Paths currentPaths = new Paths(paths);
      currentPaths.extend("[]");

      if (currentPaths.matches(pathsToIgnore)) return JsonValue.NULL;

      JsonArray jsonArray = new JsonArray();
      for (int index = 0; index < jsonValue.asArray().size(); index++) {
        currentPaths = new Paths(paths);
        currentPaths.extend("[]", "[" + index + "]");

        jsonArray.add(removePaths(jsonValue.asArray().get(index), currentPaths, pathsToIgnore));
      }
      return jsonArray;
    }
    return jsonValue;
  }
 @Override
 protected void parseMember(JsonObject.Member member) {
   super.parseMember(member);
   try {
     JsonValue value = member.getValue();
     String memberName = member.getName();
     if ("roles".equals(memberName)) {
       this.writable =
           value
               .asArray()
               .values()
               .stream()
               .filter(JsonValue::isString)
               .map(JsonValue::asString)
               .anyMatch("write"::equalsIgnoreCase);
     } else if ("link".equals(memberName)) {
       link = new OneDriveSharingLink(value.asObject());
     } else if ("grantedTo".equals(memberName)) {
       grantedTo = new OneDriveIdentitySet(value.asObject());
     } else if ("inheritedFrom".equals(memberName)) {
       JsonObject valueObject = value.asObject();
       String id = valueObject.get("id").asString();
       OneDriveFolder inheritedFromFolder = new OneDriveFolder(getApi(), id);
       inheritedFrom = inheritedFromFolder.new Reference(valueObject);
     } else if ("shareId".equals(memberName)) {
       shareId = value.asString();
     }
   } catch (ParseException e) {
     throw new OneDriveRuntimeException("Parse failed, maybe a bug in client.", e);
   }
 }
 public static JsonArray getArray(JsonObject obj, String name) {
   JsonValue value = obj.get(name);
   return value != null ? value.asArray() : null;
 }