below is my parsejason schema:
{
"type":"object",
"properties":{
"id":{"type":"string"},
"keywords":{"type":"array",
"items":{
"type":"object",
"properties":{
"keyword_id":{"type":"string"},
"text":{"type":"string"}
}
}
}
}
}
}
======================
output result:
{
"images": [
{
"id": "1135303410",
"keywords": [
{
"keyword_id": "60494",
"text": "Education",
"type": "Unknown",
"relevance": null
},
{
"keyword_id": "74709",
"text": "Pharmacy",
"type": "Unknown",
"relevance": null
},
{
"keyword_id": "60004",
"text": "People",
"type": "Unknown",
"relevance": null
}}
Goal : combine all the texts for each return keyword into a string as
combinekeywords: 'Education,PharmacyPeople'.
Anyone has any sugesstion or idea how to get this done ? Thanks in advance
Solved! Go to Solution.
Hi @vnguyen1,
Your output and JSON Schema have some parenthesis errors, you can use the data I corrected below to test:
Output:
{ "images": [ { "id": "1135303410", "keywords": [ { "keyword_id": "60494", "text": "Education", "type": "Unknown", "relevance": null }, { "keyword_id": "74709", "text": "Pharmacy", "type": "Unknown", "relevance": null }, { "keyword_id": "60004", "text": "People", "type": "Unknown", "relevance": null } ] } ] }
Schema:
{ "type": "object", "properties": { "images": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "keywords": { "type": "array", "items": { "type": "object", "properties": { "keyword_id": { "type": "string" }, "text": { "type": "string" }, "type": { "type": "string" }, "relevance": {} }, "required": [ "keyword_id", "text", "type", "relevance" ] } } }, "required": [ "id", "keywords" ] } } } }
Step 1: Put the data into the compose, then use the Parse JSON action to get the output of JSON.
Step 2: Initialize a String variable named comebinekeywords.
Step 3: Add Append to String variable action to put the "text" + "," into it.
Step 4: Process the last "," character use the expression:
substring(variables('combinekeywords'),0,sub(length(variables('combinekeywords')),1))

Please have a try, I hope it can help you.
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
i found a solution. just set variable to reset combinekeyword to NULL before the loop run. it fixed the issue
Hi @vnguyen1,
Your output and JSON Schema have some parenthesis errors, you can use the data I corrected below to test:
Output:
{ "images": [ { "id": "1135303410", "keywords": [ { "keyword_id": "60494", "text": "Education", "type": "Unknown", "relevance": null }, { "keyword_id": "74709", "text": "Pharmacy", "type": "Unknown", "relevance": null }, { "keyword_id": "60004", "text": "People", "type": "Unknown", "relevance": null } ] } ] }
Schema:
{ "type": "object", "properties": { "images": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "keywords": { "type": "array", "items": { "type": "object", "properties": { "keyword_id": { "type": "string" }, "text": { "type": "string" }, "type": { "type": "string" }, "relevance": {} }, "required": [ "keyword_id", "text", "type", "relevance" ] } } }, "required": [ "id", "keywords" ] } } } }
Step 1: Put the data into the compose, then use the Parse JSON action to get the output of JSON.
Step 2: Initialize a String variable named comebinekeywords.
Step 3: Add Append to String variable action to put the "text" + "," into it.
Step 4: Process the last "," character use the expression:
substring(variables('combinekeywords'),0,sub(length(variables('combinekeywords')),1))

Please have a try, I hope it can help you.
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @v-litu-msft i could be able to get all the keywords and put them in a string š Thanks for your help
@v-litu-msft i try to apply this to a loop , the 1st run , they pick up correct value in the combinekey, however, the next value : the combine key still keep the 1st value and did not update the new value. how to make this dynamically ? everytime to run the loop ?
Thanks in advance
@vnguyen1 wrote:Thanks @v-litu-msft i could be able to get all the keywords and put them in a string š Thanks for your help
Thanks
@v-litu-msft look like the initial value keywordcombine having an issue, it is not refresh to pick up the value everytime in the loop. it is stuck at the 1st value only. please advice
thanks
Hi @vnguyen1,
Could you please post an instance of the data of "downloads"?
Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
i found a solution. just set variable to reset combinekeyword to NULL before the loop run. it fixed the issue
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!
User | Count |
---|---|
7 | |
6 | |
5 | |
3 | |
1 |