<a id="data-exchange-object"></a>

# Data Exchange Object (DXO)

The Data Exchange Format ([`nvflare.apis.dxo.DXO`](../apidocs/nvflare.apis.dxo.md#nvflare.apis.dxo.DXO)) in NVIDIA FLARE standardizes the data passed between the communicating parties.

```python
            meta: None or dict for any additional properties
        """
        if data is None:
            data = {}
        if meta is None:
            meta = {}

        self.data_kind = data_kind
        self.data = data
        self.meta = meta

        err = self.validate()
        if err:
            raise ValueError(f"invalid DXO: {err}")

    def get_meta_prop(self, key: str, default=None):
        if self.meta and isinstance(self.meta, dict):
            return self.meta.get(key, default)
        return default

    def set_meta_prop(self, key: str, value):
        if self.meta is None:
            self.meta = {}
```

`data_kind` keeps track of the kind of data for example “WEIGHTS” or “WEIGHT_DIFF”.

`meta` is a dict that can contain additional properties.

The method [`to_shareable()`](../apidocs/nvflare.apis.dxo.md#nvflare.apis.dxo.DXO.to_shareable) produces a [Shareable](shareable.md#shareable), and a DXO can be retrieved from a
[Shareable](shareable.md#shareable) with [`nvflare.apis.dxo.from_shareable()`](../apidocs/nvflare.apis.dxo.md#nvflare.apis.dxo.from_shareable).

It is recommended to use DXO to maintain consistency in managing the data throughout the FL system.
