code: public String toJson() throws IOException {
          ObjectMapper mapper = new ObjectMapper();
          ByteArrayOutputStream out = new ByteArrayOutputStream();
  
          mapper.writeValue(out, this);
          return out.toString();
      }
docs: Converts a resource to JSON.
  
  @return JSON representation of the resource
  @throws IOException if unable to transform to JSON