import json


def transform_ora_state(state):
    """
    ORA problem state transformer transforms the problem states.

    Some state variables values are json dumped strings which needs to be loaded
    into a python object.
    """
    fields_to_transform = ['saved_response', 'saved_files_descriptions']

    for field in fields_to_transform:
        field_state = state.get(field)
        if not field_state:
            continue

        state[field] = json.loads(field_state)
    return state