web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Failed convert string ...
Power Automate
Unanswered

Failed convert string to JSON

(0) ShareShare
ReportReport
Posted on by 4

Hi all, I try to create a block of options to append in a adaptive card, for this I create a loop to append to a string each option, after I use the function JSON() to convert and add to other activity to complete adaptive card code, but the output of JSON() function only create JSON format for 1 option:

 

Compose to remove the last character (',') with all string

dajmunozos_0-1646233145214.png

the complete output is: {"type":"Container", "items": [{"type": "ColumnSet","id":"TableGroupChoiceSelection0","columns": [{"type": "Column","width": "stretch","id": "ColGroupName0","items": [{"type": "Input.ChoiceSet","choices": [{"title": "Definicion Gobierno Automatizacion","value": "Definicion Gobierno Automatizacion"}],"placeholder": "Seleccione de las siguientes opciones","id": "nameTeamChoices0","style": "expanded","isMultiSelect": true,"spacing": "None","separator": true}],"horizontalAlignment": "Left","verticalContentAlignment": "Center","height": "stretch"},{"type": "Column","width": "stretch","id": "ColTypeGroup0","items": [{"type": "Input.ChoiceSet","choices": [{"title": "1.Proyecto","value": "1.Proyecto"},{"title": "2.Operación","value": "2.Operación"},{"title": "3.Proveedores","value": "3.Proveedores"},{"title": "4.Grupo","value": "4.Grupo"},{"title": "5.Eventos","value": "5.Eventos"},{"title": "6.Comunicación","value": "6.Comunicación"},{"title": "7.Ninguno de los anteriores","value": "7.Ninguno de los anteriores"}],"placeholder": "Tipo de grupo","id": "typeTeamChoices0"}],"height": "stretch"}]}],"id": "TableRow0"},{"type":"Container", "items": [{"type": "ColumnSet","id":"TableGroupChoiceSelection1","columns": [{"type": "Column","width": "stretch","id": "ColGroupName1","items": [{"type": "Input.ChoiceSet","choices": [{"title": "Elaborar propuesta de Gobierno Automatizacion","value": "Elaborar propuesta de Gobierno Automatizacion"}],"placeholder": "Seleccione de las siguientes opciones","id": "nameTeamChoices1","style": "expanded","isMultiSelect": true,"spacing": "None","separator": true}],"horizontalAlignment": "Left","verticalContentAlignment": "Center","height": "stretch"},{"type": "Column","width": "stretch","id": "ColTypeGroup1","items": [{"type": "Input.ChoiceSet","choices": [{"title": "1.Proyecto","value": "1.Proyecto"},{"title": "2.Operación","value": "2.Operación"},{"title": "3.Proveedores","value": "3.Proveedores"},{"title": "4.Grupo","value": "4.Grupo"},{"title": "5.Eventos","value": "5.Eventos"},{"title": "6.Comunicación","value": "6.Comunicación"},{"title": "7.Ninguno de los anteriores","value": "7.Ninguno de los anteriores"}],"placeholder": "Tipo de grupo","id": "typeTeamChoices1"}],"height": "stretch"}]}],"id": "TableRow1"},{"type":"Container", "items": [{"type": "ColumnSet","id":"TableGroupChoiceSelection2","columns": [{"type": "Column","width": "stretch","id": "ColGroupName2","items": [{"type": "Input.ChoiceSet","choices": [{"title": "Gestion de pendientes","value": "Gestion de pendientes"}],"placeholder": "Seleccione de las siguientes opciones","id": "nameTeamChoices2","style": "expanded","isMultiSelect": true,"spacing": "None","separator": true}],"horizontalAlignment": "Left","verticalContentAlignment": "Center","height": "stretch"},{"type": "Column","width": "stretch","id": "ColTypeGroup2","items": [{"type": "Input.ChoiceSet","choices": [{"title": "1.Proyecto","value": "1.Proyecto"},{"title": "2.Operación","value": "2.Operación"},{"title": "3.Proveedores","value": "3.Proveedores"},{"title": "4.Grupo","value": "4.Grupo"},{"title": "5.Eventos","value": "5.Eventos"},{"title": "6.Comunicación","value": "6.Comunicación"},{"title": "7.Ninguno de los anteriores","value": "7.Ninguno de los anteriores"}],"placeholder": "Tipo de grupo","id": "typeTeamChoices2"}],"height": "stretch"}]}],"id": "TableRow2"},{"type":"Container", "items": [{"type": "ColumnSet","id":"TableGroupChoiceSelection3","columns": [{"type": "Column","width": "stretch","id": "ColGroupName3","items": [{"type": "Input.ChoiceSet","choices": [{"title": "Proyectos Procesos BPM Bizagi","value": "Proyectos Procesos BPM Bizagi"}],"placeholder": "Seleccione de las siguientes opciones","id": "nameTeamChoices3","style": "expanded","isMultiSelect": true,"spacing": "None","separator": true}],"horizontalAlignment": "Left","verticalContentAlignment": "Center","height": "stretch"},{"type": "Column","width": "stretch","id": "ColTypeGroup3","items": [{"type": "Input.ChoiceSet","choices": [{"title": "1.Proyecto","value": "1.Proyecto"},{"title": "2.Operación","value": "2.Operación"},{"title": "3.Proveedores","value": "3.Proveedores"},{"title": "4.Grupo","value": "4.Grupo"},{"title": "5.Eventos","value": "5.Eventos"},{"title": "6.Comunicación","value": "6.Comunicación"},{"title": "7.Ninguno de los anteriores","value": "7.Ninguno de los anteriores"}],"placeholder": "Tipo de grupo","id": "typeTeamChoices3"}],"height": "stretch"}]}],"id": "TableRow3"},{"type":"Container", "items": [{"type": "ColumnSet","id":"TableGroupChoiceSelection4","columns": [{"type": "Column","width": "stretch","id": "ColGroupName4","items": [{"type": "Input.ChoiceSet","choices": [{"title": "Robotic Process Automation (RPA)","value": "Robotic Process Automation (RPA)"}],"placeholder": "Seleccione de las siguientes opciones","id": "nameTeamChoices4","style": "expanded","isMultiSelect": true,"spacing": "None","separator": true}],"horizontalAlignment": "Left","verticalContentAlignment": "Center","height": "stretch"},{"type": "Column","width": "stretch","id": "ColTypeGroup4","items": [{"type": "Input.ChoiceSet","choices": [{"title": "1.Proyecto","value": "1.Proyecto"},{"title": "2.Operación","value": "2.Operación"},{"title": "3.Proveedores","value": "3.Proveedores"},{"title": "4.Grupo","value": "4.Grupo"},{"title": "5.Eventos","value": "5.Eventos"},{"title": "6.Comunicación","value": "6.Comunicación"},{"title": "7.Ninguno de los anteriores","value": "7.Ninguno de los anteriores"}],"placeholder": "Tipo de grupo","id": "typeTeamChoices4"}],"height": "stretch"}]}],"id": "TableRow4"}

 

After, I use the function JSON(outputs('EliminarUltimoCaracter')) to convert all string to JSON, but the output is this:

dajmunozos_1-1646233279341.png

{
  "type""Container",
  "items": [
    {
      "type""ColumnSet",
      "id""TableGroupChoiceSelection0",
      "columns": [
        {
          "type""Column",
          "width""stretch",
          "id""ColGroupName0",
          "items": [
            {
              "type""Input.ChoiceSet",
              "choices": [
                {
                  "title""Definicion Gobierno Automatizacion",
                  "value""Definicion Gobierno Automatizacion"
                }
              ],
              "placeholder""Seleccione de las siguientes opciones",
              "id""nameTeamChoices0",
              "style""expanded",
              "isMultiSelect"true,
              "spacing""None",
              "separator"true
            }
          ],
          "horizontalAlignment""Left",
          "verticalContentAlignment""Center",
          "height""stretch"
        },
        {
          "type""Column",
          "width""stretch",
          "id""ColTypeGroup0",
          "items": [
            {
              "type""Input.ChoiceSet",
              "choices": [
                {
                  "title""1.Proyecto",
                  "value""1.Proyecto"
                },
                {
                  "title""2.Operación",
                  "value""2.Operación"
                },
                {
                  "title""3.Proveedores",
                  "value""3.Proveedores"
                },
                {
                  "title""4.Grupo",
                  "value""4.Grupo"
                },
                {
                  "title""5.Eventos",
                  "value""5.Eventos"
                },
                {
                  "title""6.Comunicación",
                  "value""6.Comunicación"
                },
                {
                  "title""7.Ninguno de los anteriores",
                  "value""7.Ninguno de los anteriores"
                }
              ],
              "placeholder""Tipo de grupo",
              "id""typeTeamChoices0"
            }
          ],
          "height""stretch"
        }
      ]
    }
  ],
  "id""TableRow0"
}

 

Anybody knows how to convert and get the complete string in format JSON.

Categories:
I have the same question (0)
  • Verified answer
    CFernandes Profile Picture
    8,402 Most Valuable Professional on at

    Hey Mate @dajmunozos 

     

    I copy your JSON and paste it in a JSON Validator it complains that the JSON is not valid - https://jsonlint.com/ 

     

    Can you first check if your JSON is valid - Once confirmed please check the article(https://jd-bots.com/2021/10/17/convert-string-to-json-using-power-automate-microsoft-flow-work-with-parse-json/) I assume you are using the same concept but its good to check.

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

     

    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.

     

  • dajmunozos Profile Picture
    4 on at

    Thanks!, I check this extract for the JSON and is true, the JSON is not valid so to fix that I create two string variables and after create a options for the adaptive card I add this part to the main JSON and when use the compose to convert to JSON the result is successful.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard