1import ubjson
2
3data = {
4    "name": "python-ubjson",
5    "versions": ["1", "2"],
6    "group": {
7        "is_a_package": True,
8        "value": 42
9    }
10}
11serialized = ubjson.dumpb(data)
12print(serialized)
13with open("/tmp/data.json", "wb") as f:
14    f.write(serialized)
15