import json


def to_dict(data):
    """Convert json to dict data, if input is not json return None"""
    if isinstance(data, dict):
        return data
    try:
        value = json.loads(data)
        if not isinstance(value, dict):
            raise
        return value
    except:
        return None