import json


def build_client_ajax_request(p_data=None, p_error=False):
    """Build an AJAX django client request object based on given data object.

        Args:
            p_data (object): anything that will be used as data in the request. Defaults to None.

        Returns:
            dict: the built django request object containing the data passed as parameter.
    """

    return {
        'data': json.dumps(p_data)
    }