bigframes.pandas.Series.to_json#
- Series.to_json(path_or_buf=None, orient: Literal['split', 'records', 'index', 'columns', 'values', 'table'] | None = None, *, lines: bool = False, index: bool = True, allow_large_results: bool | None = None) str | None[source]#
Convert the object to a JSON string, written to Cloud Storage.
Note NaN’s and None will be converted to null and datetime objects will be converted to UNIX timestamps.
Note
Only
orient='records'andlines=Trueis supported so far.- 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.
Can be a destination URI of Cloud Storage files(s) to store the extracted dataframe in format of
gs://<bucket_name>/<object_name_or_glob>. Must contain a wildcard * character.If the data size is more than 1GB, you must use a wildcard to export the data into multiple files and the size of the files varies.
orient ({split, records, index, columns, values, table}, default ‘columns) –
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'.
index (bool, default True) – If True, write row names (index).
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.
allow_large_results (bool, default None) – If not None, overrides the global setting to allow or disallow large query results over the default size limit of 10 GB. This parameter has no effect when results are saved to Google Cloud Storage (GCS).
- Returns:
If path_or_buf is None, returns the resulting json format as a string. Otherwise returns None.
- Return type:
None or str
- Raises:
ValueError – If
linesis True butrecordsis not provided as value fororient.