Use the send method in the \phpbb\json_response class.