Skip to content

Converters

Chris Griffith edited this page Jan 23, 2022 · 2 revisions
Converter Method Description
to_dict Recursively transform all Box (and BoxList) objects back into a dict (and lists)
to_json Save Box object as a JSON string or write to a file with the filename parameter
to_yaml Save Box object as a YAML string or write to a file with the filename parameter
to_msgpack Save Box object as msgpack bytes or write to a file with the filename parameter
to_toml* Save Box object as a TOML string or write to a file with the filename parameter
to_csv** Save BoxList object as a CSV string or write to a file with the filename parameter
from_json Classmethod, Create a Box object from a JSON file or string (all Box parameters can be passed)
from_yaml Classmethod, Create a Box object from a YAML file or string (all Box parameters can be passed)
from_msgpack Classmethod, Create a Box object from a msgpack file or bytes (all Box parameters can be passed)
from_toml* Classmethod, Create a Box object from a TOML file or string (all Box parameters can be passed)
from_csv** Classmethod, Create a BoxList object from a CSV file or string (all BoxList parameters can be passed)

* Do not work with BoxList, only Box

** Do not work with Box, only BoxList