@NonNull
  private static String convertObservedUrisToJsonString(@NonNull List<ObservedUri> uris) {
    JSONObject contentUris = new JSONObject();
    JSONArray jsonFlags = new JSONArray();
    JSONArray jsonUris = new JSONArray();
    for (ObservedUri uri : uris) {
      jsonFlags.put(uri.getFlags());
      jsonUris.put(uri.getUri());
    }
    try {
      contentUris.put(JSON_URI_FLAGS, jsonFlags);
      contentUris.put(JSON_URIS, jsonUris);
    } catch (JSONException e) {
      throw new RuntimeException(e);
    }
    return contentUris.toString();
  }
JobCoder is a tool to encode and decode JobSpecs from Bundles.
jobdispatcher/src/main/java/com/firebase/jobdispatcher/JobCoder.java