def json_loads(obj, keys=None):
    """
    Given an object, this method tries to json.loads() the value of each of the keys. If json.loads
    fails, the original value stays in the object.

    :param obj: Original object whose values should be converted to json.
    :type obj: ``dict``

    :param keys: Optional List of keys whose values should be transformed.
    :type keys: ``list``

    :rtype ``dict`` or ``None``
    """
    if not obj:
        return None

    if not keys:
        keys = list(obj.keys())

    for key in keys:
        try:
            obj[key] = json_decode(obj[key])
        except Exception:
            # NOTE: This exception is not fatal so we intentionally don't log anything.
            # Method behaves in "best effort" manner and dictionary value not being JSON
            # string is perfectly valid (and common) scenario so we should not log anything
            pass
    return obj

    Given an object, this method tries to json.loads() the value of each of the keys. If json.loads
    fails, the original value stays in the object.

    :param obj: Original object whose values should be converted to json.
    :type obj: ``dict``

    :param keys: Optional List of keys whose values should be transformed.
    :type keys: ``list``

    :rtype ``dict`` or ``None``
    
st2common/st2common/util/jsonify.py