def METHOD_NAME(ctx, param, value):
    if value is not None:
        try:
            json_data = json.loads(value)
        except json.JSONDecodeError as e:
            raise click.BadParameter("Data must be in json") from e
        else:
            return json_data