code: def json(self, path, mode=None, compression=None, dateFormat=None, timestampFormat=None,
               lineSep=None, encoding=None):
          
          self.mode(mode)
          self._set_opts(
              compression=compression, dateFormat=dateFormat, timestampFormat=timestampFormat,
              lineSep=lineSep, encoding=encoding)
          self._jwrite.json(path)
docs: Saves the content of the :class:`DataFrame` in JSON format
          (`JSON Lines text format or newline-delimited JSON <http://jsonlines.org/>`_) at the
          specified path.
  
          :param path: the path in any Hadoop supported file system
          :param mode: specifies the behavior of the save operation when data already exists.
  
              * ``append``: Append contents of this :class:`DataFrame` to existing data.
              * ``overwrite``: Overwrite existing data.
              * ``ignore``: Silently ignore this operation if data already exists.
              * ``error`` or ``errorifexists`` (default case): Throw an exception if data already \
                  exists.
          :param compression: compression codec to use when saving to file. This can be one of the
                              known case-insensitive shorten names (none, bzip2, gzip, lz4,
                              snappy and deflate).
          :param dateFormat: sets the string that indicates a date format. Custom date formats
                             follow the formats at ``java.time.format.DateTimeFormatter``. This
                             applies to date type. If None is set, it uses the
                             default value, ``yyyy-MM-dd``.
          :param timestampFormat: sets the string that indicates a timestamp format.
                                  Custom date formats follow the formats at
                                  ``java.time.format.DateTimeFormatter``.
                                  This applies to timestamp type. If None is set, it uses the
                                  default value, ``yyyy-MM-dd'T'HH:mm:ss.SSSXXX``.
          :param encoding: specifies encoding (charset) of saved json files. If None is set,
                          the default UTF-8 charset will be used.
          :param lineSep: defines the line separator that should be used for writing. If None is
                          set, it uses the default value, ``\\n``.
  
          >>> df.write.json(os.path.join(tempfile.mkdtemp(), 'data'))