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 objectswill be converted to UNIX timestamps.
Note
Only
orient='records'andlines=Trueis supported so far.- Parameters:
path_or_buf (str,path object,file-like object, orNone,default None) –
String, path object (implementing os.PathLike[str]), or file-likeobject implementing a write() function. If None, the result isreturned as a string.
Can be a destination URI of Cloud Storage files(s) to store the extracteddataframe 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 toexport the data into multiple files and the size of the filesvaries.
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. Willthrow ValueError if incorrect ‘orient’ since others are notlist-like.
allow_large_results (bool,default None) – If not None, overrides the global setting to allow or disallow largequery results over the default size limit of 10 GB. This parameter hasno effect when results are saved to Google Cloud Storage (GCS).
- Returns:
If path_or_buf is None, returns the resulting json format as astring. Otherwise returns None.
- Return type:
None orstr
- Raises:
ValueError – If
linesis True butrecordsis not provided as value fororient.