code: public JSONObject toJSON(CmsObject cms, boolean includeLang) {
  
          try {
              CmsObject clone = OpenCms.initCmsObject(cms);
              clone.getRequestContext().setSiteRoot("");
              JSONObject jsonAttachment = new JSONObject();
              CmsResource res = clone.readResource(m_rootPath, CmsResourceFilter.IGNORE_EXPIRATION);
              Map<String, String> props = CmsProperty.toMap(clone.readPropertyObjects(res, false));
              // id and path
              jsonAttachment.put(JSON_UUID, res.getStructureId());
              jsonAttachment.put(JSON_PATH, res.getRootPath());
              // title
              jsonAttachment.put(JSON_TITLE, props.get(CmsPropertyDefinition.PROPERTY_TITLE));
              // date created
              jsonAttachment.put(JSON_DATE_CREATED, res.getDateCreated());
              // date created
              jsonAttachment.put(JSON_LOCALE, m_locale);
              // date modified
              jsonAttachment.put(JSON_DATE_MODIFIED, res.getDateLastModified());
  
              if (includeLang) {
                  // get all language versions of the document
                  List<CmsDocumentDependency> langs = getVariants();
                  if (langs != null) {
                      JSONArray jsonLanguages = new JSONArray();
                      for (CmsDocumentDependency lang : langs) {
  
                          JSONObject jsonLanguage = lang.toJSON(cms, false);
                          jsonLanguages.put(jsonLanguage);
                      }
                      jsonAttachment.put(JSON_LANGUAGES, jsonLanguages);
                  }
              }
              return jsonAttachment;
          } catch (Exception ex) {
              LOG.error(ex.getLocalizedMessage(), ex);
          }
          return null;
      }
docs: Returns a JSON object describing this dependency document.<p>
  
  @param cms the current cms object
  @param includeLang flag if language versions should be included
  
  @return a JSON object describing this dependency document