o_sql.html)
    * [ pandas.read_gbq ](pandas.read_gbq.html)
    * [ pandas.read_stata ](pandas.read_stata.html)
    * [ pandas.DataFrame.to_stata ](pandas.DataFrame.to_stata.html)
    * [ pandas.io.stata.StataReader.data_label ](pandas.io.stata.StataReader.data_label.html)
    * [ pandas.io.stata.StataReader.value_labels ](pandas.io.stata.StataReader.value_labels.html)
    * [ pandas.io.stata.StataReader.variable_labels ](pandas.io.stata.StataReader.variable_labels.html)
    * [ pandas.io.stata.StataWriter.write_file ](pandas.io.stata.StataWriter.write_file.html)
  * [ General functions ](../general_functions.html)
  * [ Series ](../series.html)
  * [ DataFrame ](../frame.html)
  * [ pandas arrays, scalars, and data types ](../arrays.html)
  * [ Index objects ](../indexing.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ Input/output ](../io.html)
  * pandas.DataF... 

#  pandas.DataFrame.to_json  #

DataFrame.  to_json  (  _ path_or_buf  =  None  _ , _ *  _ , _ orient  =  None
_ , _ date_format  =  None  _ , _ double_precision  =  10  _ , _ force_ascii
=  True  _ , _ date_unit  =  'ms'  _ , _ default_handler  =  None  _ , _ lines
=  False  _ , _ compression  =  'infer'  _ , _ index  =  None  _ , _ indent  =
None  _ , _ storage_options  =  None  _ , _ mode  =  'w'  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L2428-L2717) #

    

Convert the object to a JSON string.

Note NaNâs and None will be converted to null and datetime objects will be
converted to UNIX timestamps.

Parameters  :

    

**path_or_buf** str, path object, file-like object, or None, default None

    

String, path object (implementing os.PathLike[str]), or file-like object
implementing a write() function. If None, the result is returned as a string.

**orient** str

    

Indication of expected JSON string format.

  * Series: 

>     * default is âindexâ
>
>     * allowed values are: {âsplitâ, ârecordsâ, âindexâ,
> âtableâ}.

  * DataFrame: 

>     * default is âcolumnsâ
>
>     * allowed values are: {âsplitâ, ârecordsâ, âindexâ,
> âcolumnsâ, âvaluesâ, âtableâ}.

  * The format of the JSON string: 

>     * âsplitâ : dict like {âindexâ -> [index], âcolumnsâ ->
> [columns], âdataâ -> [values]}
>
>     * ârecordsâ : list like [{column -> value}, â¦ , {column -> value}]
>
>     * âindexâ : dict like {index -> {column -> value}}
>
>     * âcolumnsâ : dict like {column -> {index -> value}}
>
>     * âvaluesâ : just the values array
>
>     * âtableâ : dict like {âschemaâ: {schema}, âdataâ: {data}}
>
> Describing the data, where data component is like ` orient='records'  ` .

**date_format** {None, âepochâ, âisoâ}

    

Type of date conversion. âepochâ = epoch milliseconds, âisoâ =
ISO8601. The default depends on the  orient  . For ` orient='table'  ` , the
default is âisoâ. For all other orients, the default is âepochâ.

**double_precision** int, default 10

    

The number of decimal places to use when encoding floating point values. The
possible maximal value is 15. Passing double_precision greater than 15 will
raise a ValueError.

**force_ascii** bool, default True

    

Force encoded string to be ASCII.

**date_unit** str, default âmsâ (milliseconds)

    

The time unit to encode to, governs timestamp and ISO8601 precision. One of
âsâ, âmsâ, âusâ, ânsâ for second, millisecond, microsecond,
and nanosecond respectively.

**default_handler** callable, default None

    

Ha