def to_json(self, 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=True):
    '\n        Convert the object to a JSON string.\n\n        Note NaN\'s and None will be converted to null and datetime objects\n        will be converted to UNIX timestamps.\n\n        Parameters\n        ----------\n        path_or_buf : string or file handle, optional\n            File path or object. If not specified, the result is returned as\n            a string.\n        orient : string\n            Indication of expected JSON string format.\n\n            * Series\n\n              - default is \'index\'\n              - allowed values are: {\'split\',\'records\',\'index\',\'table\'}\n\n            * DataFrame\n\n              - default is \'columns\'\n              - allowed values are:\n                {\'split\',\'records\',\'index\',\'columns\',\'values\',\'table\'}\n\n            * The format of the JSON string\n\n              - \'split\' : dict like {\'index\' -> [index],\n                \'columns\' -> [columns], \'data\' -> [values]}\n              - \'records\' : list like\n                [{column -> value}, ... , {column -> value}]\n              - \'index\' : dict like {index -> {column -> value}}\n              - \'columns\' : dict like {column -> {index -> value}}\n              - \'values\' : just the values array\n              - \'table\' : dict like {\'schema\': {schema}, \'data\': {data}}\n                describing the data, and the data component is\n                like ``orient=\'records\'``.\n\n                .. versionchanged:: 0.20.0\n\n        date_format : {None, \'epoch\', \'iso\'}\n            Type of date conversion. \'epoch\' = epoch milliseconds,\n            \'iso\' = ISO8601. The default depends on the `orient`. For\n            ``orient=\'table\'``, the default is \'iso\'. For all other orients,\n            the default is \'epoch\'.\n        double_precision : int, default 10\n            The number of decimal places to use when encoding\n            floating point values.\n        force_ascii : bool, default True\n            Force encoded string to be ASCII.\n        date_unit : string, default \'ms\' (milliseconds)\n            The time unit to encode to, governs timestamp and ISO8601\n            precision.  One of \'s\', \'ms\', \'us\', \'ns\' for second, millisecond,\n            microsecond, and nanosecond respectively.\n        default_handler : callable, default None\n            Handler to call if object cannot otherwise be converted to a\n            suitable format for JSON. Should receive a single argument which is\n            the object to convert and return a serialisable object.\n        lines : bool, default False\n            If \'orient\' is \'records\' write out line delimited json format. Will\n            throw ValueError if incorrect \'orient\' since others are not list\n            like.\n\n            .. versionadded:: 0.19.0\n\n        compression : {\'infer\', \'gzip\', \'bz2\', \'zip\', \'xz\', None}\n\n            A string representing the compression to use in the output file,\n            only used when the first argument is a filename. By default, the\n            compression is inferred from the filename.\n\n            .. versionadded:: 0.21.0\n            .. versionchanged:: 0.24.0\n               \'infer\' option added and set to default\n        index : bool, default True\n            Whether to include the index values in the JSON string. Not\n            including the index (``index=False``) is only supported when\n            orient is \'split\' or \'table\'.\n\n            .. versionadded:: 0.23.0\n\n        See Also\n        --------\n        read_json\n\n        Examples\n        --------\n\n        >>> df = pd.DataFrame([[\'a\', \'b\'], [\'c\', \'d\']],\n        ...                   index=[\'row 1\', \'row 2\'],\n        ...                   columns=[\'col 1\', \'col 2\'])\n        >>> df.to_json(orient=\'split\')\n        \'{"columns":["col 1","col 2"],\n          "index":["row 1","row 2"],\n          "data":[["a","b"],["c","d"]]}\'\n\n        Encoding/decoding a Dataframe using ``\'records\'`` formatted JSON.\n        Note that index labels are not preserved with this encoding.\n\n        >>> df.to_json(orient=\'records\')\n        \'[{"col 1":"a","col 2":"b"},{"col 1":"c","col 2":"d"}]\'\n\n        Encoding/decoding a Dataframe using ``\'index\'`` formatted JSON:\n\n        >>> df.to_json(orient=\'index\')\n        \'{"row 1":{"col 1":"a","col 2":"b"},"row 2":{"col 1":"c","col 2":"d"}}\'\n\n        Encoding/decoding a Dataframe using ``\'columns\'`` formatted JSON:\n\n        >>> df.to_json(orient=\'columns\')\n        \'{"col 1":{"row 1":"a","row 2":"c"},"col 2":{"row 1":"b","row 2":"d"}}\'\n\n        Encoding/decoding a Dataframe using ``\'values\'`` formatted JSON:\n\n        >>> df.to_json(orient=\'values\')\n        \'[["a","b"],["c","d"]]\'\n\n        Encoding with Table Schema\n\n        >>> df.to_json(orient=\'table\')\n        \'{"schema": {"fields": [{"name": "index", "type": "string"},\n                                {"name": "col 1", "type": "string"},\n                                {"name": "col 2", "type": "string"}],\n                     "primaryKey": "index",\n                     "pandas_version": "0.20.0"},\n          "data": [{"index": "row 1", "col 1": "a", "col 2": "b"},\n                   {"index": "row 2", "col 1": "c", "col 2": "d"}]}\'\n        '
    from pandas.io import json
    if ((date_format is None) and (orient == 'table')):
        date_format = 'iso'
    elif (date_format is None):
        date_format = 'epoch'
    return json.to_json(path_or_buf=path_or_buf, obj=self, orient=orient, date_format=date_format, double_precision=double_precision, force_ascii=force_ascii, date_unit=date_unit, default_handler=default_handler, lines=lines, compression=compression, index=index)
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 : string or file handle, optional
    File path or object. If not specified, the result is returned as
    a string.
orient : string
    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, and the data component is
        like ``orient='records'``.

        .. versionchanged:: 0.20.0

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.
force_ascii : bool, default True
    Force encoded string to be ASCII.
date_unit : string, 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
    Handler to call if object cannot otherwise be converted to a
    suitable format for JSON. Should receive a single argument which is
    the object to convert and return a serialisable object.
lines : bool, default False
    If 'orient' is 'records' write out line delimited json format. Will
    throw ValueError if incorrect 'orient' since others are not list
    like.

    .. versionadded:: 0.19.0

compression : {'infer', 'gzip', 'bz2', 'zip', 'xz', None}

    A string representing the compression to use in the output file,
    only used when the first argument is a filename. By default, the
    compression is inferred from the filename.

    .. versionadded:: 0.21.0
    .. versionchanged:: 0.24.0
       'infer' option added and set to default
index : bool, default True
    Whether to include the index values in the JSON string. Not
    including the index (``index=False``) is only supported when
    orient is 'split' or 'table'.

    .. versionadded:: 0.23.0

See Also
--------
read_json

Examples
--------

>>> df = pd.DataFrame([['a', 'b'], ['c', 'd']],
...                   index=['row 1', 'row 2'],
...                   columns=['col 1', 'col 2'])
>>> df.to_json(orient='split')
'{"columns":["col 1","col 2"],
  "index":["row 1","row 2"],
  "data":[["a","b"],["c","d"]]}'

Encoding/decoding a Dataframe using ``'records'`` formatted JSON.
Note that index labels are not preserved with this encoding.

>>> df.to_json(orient='records')
'[{"col 1":"a","col 2":"b"},{"col 1":"c","col 2":"d"}]'

Encoding/decoding a Dataframe using ``'index'`` formatted JSON:

>>> df.to_json(orient='index')
'{"row 1":{"col 1":"a","col 2":"b"},"row 2":{"col 1":"c","col 2":"d"}}'

Encoding/decoding a Dataframe using ``'columns'`` formatted JSON:

>>> df.to_json(orient='columns')
'{"col 1":{"row 1":"a","row 2":"c"},"col 2":{"row 1":"b","row 2":"d"}}'

Encoding/decoding a Dataframe using ``'values'`` formatted JSON:

>>> df.to_json(orient='values')
'[["a","b"],["c","d"]]'

Encoding with Table Schema

>>> df.to_json(orient='table')
'{"schema": {"fields": [{"name": "index", "type": "string"},
                        {"name": "col 1", "type": "string"},
                        {"name": "col 2", "type": "string"}],
             "primaryKey": "index",
             "pandas_version": "0.20.0"},
  "data": [{"index": "row 1", "col 1": "a", "col 2": "b"},
           {"index": "row 2", "col 1": "c", "col 2": "d"}]}'
def to_json(self, 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=True):
    '\n        Convert the object to a JSON string.\n\n        Note NaN\'s and None will be converted to null and datetime objects\n        will be converted to UNIX timestamps.\n\n        Parameters\n        ----------\n        path_or_buf : string or file handle, optional\n            File path or object. If not specified, the result is returned as\n            a string.\n        orient : string\n            Indication of expected JSON string format.\n\n            * Series\n\n              - default is \'index\'\n              - allowed values are: {\'split\',\'records\',\'index\',\'table\'}\n\n            * DataFrame\n\n              - default is \'columns\'\n              - allowed values are:\n                {\'split\',\'records\',\'index\',\'columns\',\'values\',\'table\'}\n\n            * The format of the JSON string\n\n              - \'split\' : dict like {\'index\' -> [index],\n                \'columns\' -> [columns], \'data\' -> [values]}\n              - \'records\' : list like\n                [{column -> value}, ... , {column -> value}]\n              - \'index\' : dict like {index -> {column -> value}}\n              - \'columns\' : dict like {column -> {index -> value}}\n              - \'values\' : just the values array\n              - \'table\' : dict like {\'schema\': {schema}, \'data\': {data}}\n                describing the data, and the data component is\n                like ``orient=\'records\'``.\n\n                .. versionchanged:: 0.20.0\n\n        date_format : {None, \'epoch\', \'iso\'}\n            Type of date conversion. \'epoch\' = epoch milliseconds,\n            \'iso\' = ISO8601. The default depends on the `orient`. For\n            ``orient=\'table\'``, the default is \'iso\'. For all other orients,\n            the default is \'epoch\'.\n        double_precision : int, default 10\n            The number of decimal places to use when encoding\n            floating point values.\n        force_ascii : bool, default True\n            Force encoded string to be ASCII.\n        date_unit : string, default \'ms\' (milliseconds)\n            The time unit to encode to, governs timestamp and ISO8601\n            precision.  One of \'s\', \'ms\', \'us\', \'ns\' for second, millisecond,\n            microsecond, and nanosecond respectively.\n        default_handler : callable, default None\n            Handler to call if object cannot otherwise be converted to a\n            suitable format for JSON. Should receive a single argument which is\n            the object to convert and return a serialisable object.\n        lines : bool, default False\n            If \'orient\' is \'records\' write out line delimited json format. Will\n            throw ValueError if incorrect \'orient\' since others are not list\n            like.\n\n            .. versionadded:: 0.19.0\n\n        compression : {\'infer\', \'gzip\', \'bz2\', \'zip\', \'xz\', None}\n\n            A string representing the compression to use in the output file,\n            only used when the first argument is a filename. By default, the\n            compression is inferred from the filename.\n\n            .. versionadded:: 0.21.0\n            .. versionchanged:: 0.24.0\n               \'infer\' option added and set to default\n        index : bool, default True\n            Whether to include the index values in the JSON string. Not\n            including the index (``index=False``) is only supported when\n            orient is \'split\' or \'table\'.\n\n            .. versionadded:: 0.23.0\n\n        See Also\n        --------\n        read_json\n\n        Examples\n        --------\n\n        >>> df = pd.DataFrame([[\'a\', \'b\'], [\'c\', \'d\']],\n        ...                   index=[\'row 1\', \'row 2\'],\n        ...                   columns=[\'col 1\', \'col 2\'])\n        >>> df.to_json(orient=\'split\')\n        \'{"columns":["col 1","col 2"],\n          "index":["row 1","row 2"],\n          "data":[["a","b"],["c","d"]]}\'\n\n        Encoding/decoding a Dataframe using ``\'records\'`` formatted JSON.\n        Note that index labels are not preserved with this encoding.\n\n        >>> df.to_json(orient=\'records\')\n        \'[{"col 1":"a","col 2":"b"},{"col 1":"c","col 2":"d"}]\'\n\n        Encoding/decoding a Dataframe using ``\'index\'`` formatted JSON:\n\n        >>> df.to_json(orient=\'index\')\n        \'{"row 1":{"col 1":"a","col 2":"b"},"row 2":{"col 1":"c","col 2":"d"}}\'\n\n        Encoding/decoding a Dataframe using ``\'columns\'`` formatted JSON:\n\n        >>> df.to_json(orient=\'columns\')\n        \'{"col 1":{"row 1":"a","row 2":"c"},"col 2":{"row 1":"b","row 2":"d"}}\'\n\n        Encoding/decoding a Dataframe using ``\'values\'`` formatted JSON:\n\n        >>> df.to_json(orient=\'values\')\n        \'[["a","b"],["c","d"]]\'\n\n        Encoding with Table Schema\n\n        >>> df.to_json(orient=\'table\')\n        \'{"schema": {"fields": [{"name": "index", "type": "string"},\n                                {"name": "col 1", "type": "string"},\n                                {"name": "col 2", "type": "string"}],\n                     "primaryKey": "index",\n                     "pandas_version": "0.20.0"},\n          "data": [{"index": "row 1", "col 1": "a", "col 2": "b"},\n                   {"index": "row 2", "col 1": "c", "col 2": "d"}]}\'\n        '
    from pandas.io import json
    if ((date_format is None) and (orient == 'table')):
        date_format = 'iso'
    elif (date_format is None):
        date_format = 'epoch'
    return json.to_json(path_or_buf=path_or_buf, obj=self, orient=orient, date_format=date_format, double_precision=double_precision, force_ascii=force_ascii, date_unit=date_unit, default_handler=default_handler, lines=lines, compression=compression, index=index)