import json


def _read_as_json(configuration):
    """
    Attempts to read all of the values
    in the configuration dictionary as json
    string.  If it fails, it just uses the original value

    :param dict configuration: Raw configuration
    :return: Json loaded configuration
    :rtype: dict
    """
    new_config = {}
    for key, value in configuration.items():
        try:
            value = json.loads(value)
        except (ValueError, TypeError):
            pass
        new_config[key] = value
    return new_config