[Bug]: BoundingBoxes2D: describe the existing artifact JSON list in annotations
Describe the bug
wandb.data_types.BoundingBoxes2D.to_json is annotated to return dict, but its artifact serialization deliberately returns a list of box dictionaries. The paired from_json advertises json_obj: dict while requiring that list representation.
The list format is intentional for compatibility: current source and comment. The request is to align the annotations with that existing format, including the different Run/Artifact branches.
Minimal reproduction
import wandb
from wandb.data_types import BoundingBoxes2D
data = [{
"position": {"minX": 0.1, "maxX": 0.2, "minY": 0.3, "maxY": 0.4},
"class_id": 0,
}]
boxes = BoundingBoxes2D({"box_data": data}, key="predictions")
artifact = wandb.Artifact("example", type="dataset")
payload = boxes.to_json(artifact)
print(type(payload).__name__) # list, despite -> dict
assert BoundingBoxes2D.from_json(payload, artifact).to_json(artifact) == payload
BoundingBoxes2D.from_json({"box_data": data}, artifact)The actual list round-trip succeeds. The dictionary call fails:
TypeError: Boxes must be a listThis uses a real local Artifact and valid box coordinates; no run or server is involved. Image.from_json also consumes the list representation through this helper.
Expected behavior
Make the serializer/deserializer annotations describe the supported payloads without changing their existing serialization format.
Environment
- W&B SDK: 0.30.0; relevant source is identical on main
8f93d444e29e4d1a50a888899f51051012ee2679 - Python: 3.12.12
- OS: macOS 26.1, arm64
- W&B server: not applicable
Source: wandb/wandb