private JsonObject toJson(Keyset keyset) {
    JsonObject json = new JsonObject();
    json.addProperty("primaryKeyId", toUnsignedLong(keyset.getPrimaryKeyId()));
    JsonArray keys = new JsonArray();
    for (Keyset.Key key : keyset.getKeyList()) {
      keys.add(toJson(key));
    }
    json.add("key", keys);
    return json;
  }
Static method to create a JsonKeysetWriter that writes to a file path.

<p>This method only works on Android API level 26 or newer.

@deprecated Method should be inlined.
java_src/src/main/java/com/google/crypto/tink/JsonKeysetWriter.java