MCPcopy Create free account
hub / github.com/cdgriffith/Box / to_json

Method to_json

box/box.py:1332–1348  ·  view source on GitHub ↗

Transform the Box 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 json_kwargs: additional arguments to pass to json.dump(s) :return: string o

(
        self,
        filename: str | PathLike | None = None,
        encoding: str = "utf-8",
        errors: str = "strict",
        **json_kwargs,
    )

Source from the content-addressed store, hash-verified

1330 raise BoxError(f"Duplicate conversion attributes exist: {dups}")
1331
1332 def to_json(
1333 self,
1334 filename: str | PathLike | None = None,
1335 encoding: str = "utf-8",
1336 errors: str = "strict",
1337 **json_kwargs,
1338 ):
1339 """
1340 Transform the Box object into a JSON string.
1341
1342 :param filename: If provided will save to file
1343 :param encoding: File encoding
1344 :param errors: How to handle encoding errors
1345 :param json_kwargs: additional arguments to pass to json.dump(s)
1346 :return: string of JSON (if no filename provided)
1347 """
1348 return _to_json(self.to_dict(), filename=filename, encoding=encoding, errors=errors, **json_kwargs)
1349
1350 @classmethod
1351 def from_json(

Calls 2

to_dictMethod · 0.95
_to_jsonFunction · 0.90