memoryfm.ScrobbleLog.to_json#
- ScrobbleLog.to_json(file=None, orient='records', datetimefmt='%Y-%m-%dT%H:%M:%S%z')#
Convert a ScrobbleLog to a canonical JSON.
A canonical JSON is of the form
Canonical JSON format## A canonical JSON { "meta": ScrobbleLog.meta, "scrobbles": ScrobbleLog.df.to_dict(orient=orient), }
- Parameters:
- filePathLike or TextIOBase object.
A pathlib path, or
A string corresponding to a path, such as
/home/username/Documents/filename, orA TextIOBase object having a
read()method.
- orientstr, default ‘records’
The style of values of
scrobbleskey. Allowed orient values arerecords: list like[{column -> value}, ... , {column -> value}]index: dict like{index -> {column -> value}}columns: dict like{column -> {index -> value}}
- datetimefmtstr, default ‘%Y-%m-%dT%H:%M:%S%z’
A string representing a valid datetime format built from format codes. For example: ‘%Y-%m-%d’ would be a date of the format YYYY-MM-DD. The default is the standard ISO 8601 with the UTC offset.
- Returns:
- None or str
If file is
None, returns the JSON string. ReturnsNoneotherwise.