def to_tree(cls, spec_coord, ctx):
        node = {}
        if isinstance(spec_coord, SpectralCoord):
            node['value'] = spec_coord.value
            node['unit'] = spec_coord.unit
            if spec_coord.observer is not None:
                node['observer'] = spec_coord.observer
            if spec_coord.target is not None:
                node['target'] = spec_coord.target
            return node
        raise TypeError(f"'{spec_coord}' is not a valid SpectralCoord")