Forming JSON for API from Repeating Group

Problem: Forming JSON for API from Repeating Group

I need to send a list of exercises to an external API (LanguageTool Checker). Each exercise consists of three parts (before_blank_text , user_selected_answer , after_blank_text ). The exercise data (before_blank_text , after_blank_text ) is sourced from a Repeating Group (data source - external API Vercel JSON Parser ), and user_selected_answer is text entered by the user into an input field within each Repeating Group cell.

The API expects a JSON array in the following format:

{
  "original_topic": "Grammaire B1",
  "exercises": [
    {
      "before_blank_text": "...",
      "user_selected_answer": "...",
      "after_blank_text": "..."
    },
    // ...
  ]
}

Problem: I am unable to form this valid JSON array on the Bubble frontend.

Inability to access Input.value :Within the :format as text operator for the Repeating Group (when building the Body (JSON object) for the API call), I cannot retrieve the value of Current cell's Input Votre réponse's Input_reponse .

  • Lack of index in list For Vercel_JSON_Parser body exercise elements (which are not “Things” from the Bubble database), the :index in list operator is unavailable. This prevents reliable matching of exercise data with user answers by order.
    -“Invalid JSON” errors: All attempts at manually concatenating strings and using json_safe result in invalid JSON and an Overall Request Body Parsing Error: Invalid JSON from the API.
  • JavaScript for DOM data collection proved unreliable and unworkable** in this Bubble context.
    Question to the community - Given these limitations, what is the most reliable “Bubble-native” way to form such a JSON array from a Repeating Group (element data + input field value within that element) for sending to an external API? If Backend Workflows are necessary, how should they be correctly configured for data collection and formatting?

I don’t know exactly how is formatted your JSON parser body exercicse element so it will be hard to help you. Normally, for the list, you need to use format as text on the list and format the JSON there for the array.

The invalid JSON can also be from wrong JSON encoding. Use of JSON-safe should help, if you use it correctly at the right place!

Share screenshots and more info and maybe we can help. But One question remain, why are you using a plugin to parse the JSON?

1 Like

Hi Jici! Thank you for your kindness! I would like to connect with you to discuss the topic of Forming JSON for API from Repeating Group in more detail. I am also currently looking for a specialist to debug user answer validation in my Repeating Group. My WhatsApp +337673133830, email ekaterinamourin@gmail.com

This topic was automatically closed after 70 days. New replies are no longer allowed.