> For the complete documentation index, see [llms.txt](https://docs.ngsurvey.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ngsurvey.com/fr/form-management/tasks/task-items/webhook/webhooks-payload-transform.md).

# Transformation de la charge utile des Webhooks

## 🔃 À quoi sert la transformation de la charge utile des Webhooks ?

Toutes les API destinataires de la charge utile des réponses des répondants ne sont pas identiques ; vous pouvez utiliser le modèle de transformation pour convertir le JSON d'origine des réponses du répondant en un autre JSON personnalisé de votre choix afin de correspondre exactement aux spécifications de toute API tierce.

Ci‑dessous un exemple simple qui reformate les noms des propriétés de la charge utile d'origine avec de nouveaux noms personnalisés et crée une représentation hiérarchique du répondant et de ses réponses. Il est bien sûr possible de retransformer complètement le JSON d'origine en n'importe quel type de structure JSON.

```
{
    "myCustomRespondent": {
    "id": "#valueof($.respondent.id)",
    "surveyId": "#valueof($.respondent.surveyId)",
    "panelistId": "#valueof($.respondent.panelistId)",
    "contextUsername": "#valueof($.respondent.contextUsername)",
    "resumeUId": "#valueof($.respondent.resumeUId)",
    "resumePageId": "#valueof($.respondent.resumePageId)",
    "startDate": "#valueof($.respondent.startDate)",
    "voteDate": "#valueof($.respondent.voteDate)",
    "iPSource": "#valueof($.respondent.iPSource)",
    "changeUID": "#valueof($.respondent.changeUID)",
    "progressSaveDate": "#valueof($.respondent.progressSaveDate)",
    "languageCode": "#valueof($.respondent.languageCode)",
    "timeToEnd": "#valueof($.respondent.timeToEnd)",
    "validated": "#valueof($.respondent.validated)",
    "myQuerystring": "#valueof($.querystring)",
    "myCustomAnswers":{
      "#loop($.answers)": {
        "respondentId": "#currentvalueatpath($.respondentId)",
        "value":"#currentvalueatpath($.value)",
        "answerId": "#currentvalueatpath($.answerId)",
        "answerText": "#currentvalueatpath($.answerText)",
        "questionId": "#currentvalueatpath($.questionId)",
        "questionAlias": "#currentvalueatpath($.questionAlias)",
        "questionText": "#currentvalueatpath($.questionText)",
        "sectionNumber": "#currentvalueatpath($.sectionNumber)"
      }
    },
      "myCustomDataAttributes":{
      "#loop($.dataAttributes)": {
        "securityItemId": "#currentvalueatpath($.securityItemId)",
        "respondentId":"#currentvalueatpath($.respondentId)",
        "attributeName": "#currentvalueatpath($.attributeName)",
        "attributeValue": "#currentvalueatpath($.attributeValue)"
      }
    },
      "myVisitedPages":{
      "#loop($.visitedPages)": {
        "id": "#currentvalueatpath($.id)",
        "respondentId":"#currentvalueatpath($.respondentId)",
        "visitTime": "#currentvalueatpath($.visitTime)"
      }
    }
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ngsurvey.com/fr/form-management/tasks/task-items/webhook/webhooks-payload-transform.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
