Hello,
i'm building a flow for my PowerApps application, but i got a problem.
I'm using a web-service to get data that I parse with the parse JSON stage. The problem is that the response of my web service is not returning a fix number of objects, it can be 1 as 56.
Currently this is my JSON schema :
{ "type": "object", "properties": { "chantiers": { "type": "object", "properties": { "chantier": { "type": "object", "properties": { "code_affaire": { "type": "string" }, "code_analytique": { "type": "integer" }, "description": { "type": "string" }, "distance": { "type": "number" }, "ville": { "type": "string" }, "bo_fav": { "type": "boolean" } } } } } } }
This schema is working for 1 response but not for more.
I got this error message :
How can i create a "dynamic" schema that is adapting according to the response
Tell me if you need more informations,
Thibaut Gautier
Hi @Anonymous , thank you for your post in the Flow community.
Before suggesting anything else, based on the image you have posted, what I would do is as follows:
In "Contenu", copy the whole output (ctrl + A / ctrl + C) and rebuild your schema by clicking "Use sample payload".
Once you have done that , try your Flow again. Please let us know how you get on.
p.s. Apologies in advance if you have tried this, juist I can't tell if you have or haven't from your post.
If you have found my post helpful, please mark thumbs up.
Any other questions, just ask.
Thanks, Alan
Proud to be a Flownaut!
Hi @AlanPs1 ,
firstly thank you for the answer.
Actually you're right i did not mention it, i used "Use sample payload" to built my schema.
Thanks, Thibaut
I up the topic, maybe for new answers.
Hi @Anonymous
Have you rebuilt the schema using the Output from "Contenu"?
Just to check you have done that?
Thanks, Alan
Proud to be a Flownaut!
I'd like an answer to this as well, I have a weather API in which one of the elements is the date the weather was pulled, so having it in my schema is mucking things up. If I could have the schema update with the date the weather is being pulled from, I would be golden.
Hi @AveDog08
Try this schema. This should allow no fixed amount using patternProperties and some RegEx.
It has it's limitations but for your purpose, it may just be what you need.
Please paste in and do not build the schema.
{
"patternProperties": {
"^.*$": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
}
If you find my posts helpful, please mark with thumbs up
If this solves your issue, please click "Accept as Solution"
Any questions, just ask.
Thanks, Alan
Proud to be a Flownaut!
User | Count |
---|---|
102 | |
40 | |
28 | |
23 | |
16 |
User | Count |
---|---|
132 | |
52 | |
49 | |
36 | |
24 |