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

Method to_json

box/box.py:1349–1365  ·  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

1347 raise BoxError(f"Duplicate conversion attributes exist: {dups}")
1348
1349 def to_json(
1350 self,
1351 filename: str | PathLike | None = None,
1352 encoding: str = "utf-8",
1353 errors: str = "strict",
1354 **json_kwargs,
1355 ):
1356 """
1357 Transform the Box object into a JSON string.
1358
1359 :param filename: If provided will save to file
1360 :param encoding: File encoding
1361 :param errors: How to handle encoding errors
1362 :param json_kwargs: additional arguments to pass to json.dump(s)
1363 :return: string of JSON (if no filename provided)
1364 """
1365 return _to_json(self.to_dict(), filename=filename, encoding=encoding, errors=errors, **json_kwargs)
1366
1367 @classmethod
1368 def from_json(

Calls 2

to_dictMethod · 0.95
_to_jsonFunction · 0.90