import json


def json_list(ctx, param, value):
    """Load a list from a JSON string.

    :param ctx: Click context
    :param param: Parameter info
    :param value: JSON string
    :return list: Loaded list
    """
    if type(value) is str:
        value = json.loads(value)
    if type(value) not in [list, type(None)]:
        ctx.fail("Invalid option: %s=%s, which must be list, str, or None." % (param.name, value))
    return value