Hi All,
I am trying to get a string value from within a JSON object that I receive. I would like to have have a string after the ParseJSON step which shows the product names - "Product Name A;Product Name B;Product Name C;Product Name D"
[
{
"CustomerName": "Customer A",
"DocumentType": "Word",
"Product": [
{
"Value": "Product Name A"
},
{
"Value": "Product Name B"
},
{
"Value": "Product Name C"
},
{
"Value": "Product Name D"
}
]
}
]
The demo flow I posted does not need the Parse JSON action. It uses an expression to "grab" the Product array.
Place your data in to the varJSON variable:
However, if you still need to use the Parse JSON function, then modify the expression in the Select action to:
body('Parse_JSON')?[0]?['Product']
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
Hi @ekarim2020
Thank you for your answer and I tried your steps but had no success 😞
I also look at the raw output of my ParseJSON step and it also had the word body at the head of of the object. I assumed I could just reference the using this expression "outputs('ParseJSON')?['body']?['Product'] but that also failed.
{
"body": [
{
"CustomerName": "Customer Name",
"DocumentType": "Word"
"Product": [
{
"Value": "Product A"
},
{
"Value": "Product B"
},
{
"Value": "Product C"
},
{
"Value": "Product D"
}
]
}
]
}
Hi @Dhiran ,
We can use the Select and Join actions to create the string.
(2) We can use the Select action Product property. We use the Select action to select the first item (0) of the varJSON array variable, and then specify the Product property - which is also an array. The expressions are shown below:
The output of the Select action is an array of product names:
[
"Product Name A",
"Product Name B",
"Product Name C",
"Product Name D"
]
(3) Finally, we can join all the product names together using the Join action
The output of the Join action is:
Product Name A;Product Name B;Product Name C;Product Name D
Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.
WarrenBelz
146,731
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,075
Most Valuable Professional