import json


def block_schema_version_to_dict(block_schema_version):
    """Serializes block schema version to dict.

    Args:
        block_schema_version
            (:class:`b2share.modules.schemas.api:BlockSchemaVersion`):
            block schema version that will be serialized.

    Returns:
        dict: serialized BlockSchemaVersion.
    """
    return dict(
        id=block_schema_version.block_schema.id,
        version=block_schema_version.version,
        json_schema=json.loads(block_schema_version.json_schema),
    )