Kansas City PowerApps and Flow User Group

Please login or click SIGN UP FOR FREE to create your PowerPlatformUG account to join this user group.

Issues with appending JSON Keys to an Object

  • 1.  Issues with appending JSON Keys to an Object

    Bronze Contributor
    Posted Mar 13, 2019 09:26 AM
    Hi all,

    I'm in need of assistance converting a CSV to JSON Keys, that then appends the keys to the JSON 'Autoshares' object.

    I've built out a pretty robust flow to convert a CSV to a JSON array, however the output isn't exactly what I need.

    Does anyone have any thoughts on getting the flow to shape the data to be a key versus an object/array, that I can then append together?

    Here's a sample of what the structure needs to look like.
    "autoshares": {
            "role_f71d8c2e3cf944c1a6885c2862043383": {
                "edit": [
                    "user_2ac2eba02f414d72b4b57468b34fedb7",
                    "role_fc2d7304d8fb4bbab7d9090a30685feb"
                ],
                "view": [
                    "user_2ac2eba02f414d72b4b57468b34fedb7",
                    "role_fc2d7304d8fb4bbab7d9090a30685feb",
                    "role_f71d8c2e3cf944c1a6885c2862043383"
                ],
                "delete": [
                    "user_2ac2eba02f414d72b4b57468b34fedb7",
                    "role_fc2d7304d8fb4bbab7d9090a30685feb"
                ]
            },
            "role_f71d8c2e3cf944c1a6885c2862043383": {
                "edit": [
                    "user_2ac2eba02f414d72b4b57468b34fedb7",
                    "role_fc2d7304d8fb4bbab7d9090a30685feb"
                ],
                "view": [
                    "user_2ac2eba02f414d72b4b57468b34fedb7",
                    "role_fc2d7304d8fb4bbab7d9090a30685feb",
                    "role_f71d8c2e3cf944c1a6885c2862043383"
                ],
                "delete": [
                    "user_2ac2eba02f414d72b4b57468b34fedb7",
                    "role_fc2d7304d8fb4bbab7d9090a30685feb"
                ]
            }
        },

    Here's what is appending to the JSON Array I've built.

    {
      "autoshares": [
        {
          "role_60c88ba6009245b0bfc390927db0e9d0": {
            "edit": [
              "role_eeae863e2bde4a83ab56525ae8f28b82",
              "role_5bb2e8361d4a4695bb83d6fdffa1b8a5"
            ],
            "view": [
              "role_60c88ba6009245b0bfc390927db0e9d0",
              "role_5bb2e8361d4a4695bb83d6fdffa1b8a5",
              "role_f1bbaa24d30743a99b87ad45f1403d9e",
              "role_eeae863e2bde4a83ab56525ae8f28b82"
            ],
            "delete": [
              "role_5bb2e8361d4a4695bb83d6fdffa1b8a5"
            ]
          }
        },
        {
          "role_42ce3ad58f1e47348d51b870e3e34c1b": {
            "edit": [
              "role_eeae863e2bde4a83ab56525ae8f28b82",
              "role_5bb2e8361d4a4695bb83d6fdffa1b8a5"
            ],
            "view": [
              "role_42ce3ad58f1e47348d51b870e3e34c1b",
              "role_5bb2e8361d4a4695bb83d6fdffa1b8a5",
              "role_f1bbaa24d30743a99b87ad45f1403d9e",
              "role_eeae863e2bde4a83ab56525ae8f28b82"
            ],
            "delete": [
              "role_5bb2e8361d4a4695bb83d6fdffa1b8a5"
            ]
          }
        }
      ]
    }
    As you can see, I have too many {}  and [] in my output and I'm not sure how to eliminate these.

    Here's screenshots of my flow: 
    Details on each step:







    ------------------------------
    Joshua Yeamans
    Product Specialist
    Kansas City MO
    9135751209
    ------------------------------