box/box_list.py
def to_json(
        self,
        filename: Union[str, PathLike] = None,
        encoding: str = "utf-8",
        errors: str = "strict",
        multiline: bool = False,
        **json_kwargs,
    ):
        """
        Transform the BoxList object into a JSON string.

        :param filename: If provided will save to file
        :param encoding: File encoding
        :param errors: How to handle encoding errors
        :param multiline: Put each item in list onto it's own line
        :param json_kwargs: additional arguments to pass to json.dump(s)
        :return: string of JSON or return of `json.dump`
        """
        if filename and multiline:
            lines = [_to_json(item, filename=None, encoding=encoding, errors=errors, **json_kwargs) for item in self]
            with open(filename, "w", encoding=encoding, errors=errors) as f:
                f.write("\n".join(lines))
        else:
            return _to_json(self.to_list(), filename=filename, encoding=encoding, errors=errors, **json_kwargs)

        Transform the BoxList object into a JSON string.

        :param filename: If provided will save to file
        :param encoding: File encoding
        :param errors: How to handle encoding errors
        :param multiline: Put each item in list onto it's own line
        :param json_kwargs: additional arguments to pass to json.dump(s)
        :return: string of JSON or return of `json.dump`
        
Transform the BoxList object into a JSON string.
Transform the BoxList object into a JSON string .
def to_json(
        self,
        filename: Union[str, PathLike] = None,
        encoding: str = "utf-8",
        errors: str = "strict",
        multiline: bool = False,
        **json_kwargs,
    ):
        if filename and multiline:
            lines = [_to_json(item, filename=None, encoding=encoding, errors=errors, **json_kwargs) for item in self]
            with open(filename, "w", encoding=encoding, errors=errors) as f:
                f.write("\n".join(lines))
        else:
            return _to_json(self.to_list(), filename=filename, encoding=encoding, errors=errors, **json_kwargs)
def to_json ( self , filename : Union [ str , PathLike ] = None , encoding : str = "utf-8" , errors : str = "strict" , multiline : bool = False , ** json_kwargs , ) : if filename and multiline : lines = [ _to_json ( item , filename = None , encoding = encoding , errors = errors , ** json_kwargs ) for item in self ] with open ( filename , "w" , encoding = encoding , errors = errors ) as f : f . write ( "\n" . join ( lines ) ) else : return _to_json ( self . to_list ( ) , filename = filename , encoding = encoding , errors = errors , ** json_kwargs )
Transform the BoxList object into a JSON string.
Transform the BoxList object into a JSON string .
"""
        Transform the BoxList object into a JSON string.

        :param filename: If provided will save to file
        :param encoding: File encoding
        :param errors: How to handle encoding errors
        :param multiline: Put each item in list onto it's own line
        :param json_kwargs: additional arguments to pass to json.dump(s)
        :return: string of JSON or return of `json.dump`
        """
string of JSON or return of `json.dump`
string of JSON or return of ` json . dump `
self
filename
Union[str, PathLike]
If provided will save to file
If provided will save to file
encoding
str
None
errors
str
None
multiline
bool
Put each item in list onto it's own line
Put each item in list onto it ' s own line
json_kwargs
additional arguments to pass to json.dump(s)
additional arguments to pass to json . dump ( s )