cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mousman85
Helper III
Helper III

Format response an array

I have a flow that receives a JotForm as a trigger, the repsonse from the jotform comes in formatted: 

 

[{\"Specialisms\":\"Construction\",\"Rate\":\"200\"},{\"Specialisms\":\"Producer\",\"Rate\":\"600\"},{\"Specialisms\":\"Lighting\",\"Rate\":\"500\"},{\"Specialisms\":\"Production Manager\",\"Rate\":\"400\"},{\"Specialisms\":\"Showcaller\",\"Rate\":\"200\"}]

 

I need to turn the above in to an array so I can select the results to compare against another array to get some values. 

 

I've tried splitting it using "," and "},{" but it keeps returning the "\" no matter what I do. If I turn it in to a string the "\" go away, but soon as I make that back to an array using a split function I get all the "\" again. I've tried using a split(replace( function but no luck and and running "replace()" on the array fails as it says it needs to be a string. 

 

Any help would be great, the above result coming in is very close to an array already but it won't let me use it direct to create the array. 

1 ACCEPTED SOLUTION

Accepted Solutions
manuelstgomes
Super User
Super User

Hi @mousman85 

 

There's an easier way. Here's the Flow I created to parse the data:

2021-06-09 12_25_37-Window.png

 

Make it a valid JSON by replacing the \" to ".

replace(variables('VALUE'),'\"','"')

 

Then you can use a parse JSON. Your schema should be something like this:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Specialisms": {
                "type": "string"
            },
            "Rate": {
                "type": "string"
            }
        },
        "required": [
            "Specialisms",
            "Rate"
        ]
    }
}

 

Then you can use the output of the parse json as an array.

 

Can you please check if and let me know if you have any questions?

 

Cheers
Manuel

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

 

View solution in original post

3 REPLIES 3
manuelstgomes
Super User
Super User

Hi @mousman85 

 

There's an easier way. Here's the Flow I created to parse the data:

2021-06-09 12_25_37-Window.png

 

Make it a valid JSON by replacing the \" to ".

replace(variables('VALUE'),'\"','"')

 

Then you can use a parse JSON. Your schema should be something like this:

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Specialisms": {
                "type": "string"
            },
            "Rate": {
                "type": "string"
            }
        },
        "required": [
            "Specialisms",
            "Rate"
        ]
    }
}

 

Then you can use the output of the parse json as an array.

 

Can you please check if and let me know if you have any questions?

 

Cheers
Manuel

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

 

View solution in original post

Paulie78
Super User
Super User

Use the expression:

json(replace(outputs('Compose'),'\', ''))

replace outputs('Compose') with whatever your action is called.

Perfect thanks for this, after I posted I went down this route and it works great. 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,619)