import json


def json_loads_or_raw(data):
    """
    Try to get a JSON object from a string.
    If this isn't JSON, return the raw string.
    :param data: string; should be in JSON format
    :return: JSON-decoded object or raw data
    """
    if not data:
        return None
    try:
        return json.loads(data)
    except Exception:
        return data