import json


def decode(data, default=None):
    """ Load JSON data from a string

    Args:
        data: JSON data to decode.
        default: Value to return if decoding fails.
            Defaults to an empty dictionary
    """
    if default is None:
        default = {}
    try:
        return json.loads(data)
    except ValueError:
        return default