cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver I
Resolver I

Parsing http response body: template

HTTP request action that listents to webhooks requires setting a template JSON. 

The JSON we expect has a number of fields that normally contain integers, like all kind of counters.

But occasionally these fields would be blank in the original system and so the JSON would contain the word "null" instead of an integer.

 

In the past I would just manually fix the JSON template created from the sample to replace the "integer" with "string" in the field definition. But since last week the flow would fail on this:

either we get an integer and flow reports that it was expecting a string, or we get "null" and flow complains that it expects "integer".

 

There are some 800 lines in incoming JSON so processing all potential null values individually in the flow before we would ever be able to access specific values is not an option.

 

How should we overcome this problem?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi, 

thank you for stepping in.

I won't be able to post the specific json as it is very large. 

In the meanwhile I've found a suggestion to add null value to the list of allowed types like this:

 

"CompanyName": {
"type": [
"string",
"null"
]
or this:
 
"Expressions": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "AttributeID": {},
                                "AttributeName": {
                                    "type": [
                                        "string",
                                        "null",
                                        "integer"
                                    ]
                                },
                                "Operator": {
                                    "type": "string"
                                },
                                "Value": {
                                    "type": [
                                        "string",
                                        "null",
                                        "integer"
                                    ]
                                }
                            },

I've taken it one step further and added other types to the list so both integer and string would be accepted and this seems to be working.

 

Thanks to @Ben_Love!

Solution found here : https://powerusers.microsoft.com/t5/Building-Flows/parse-JSON-Ignoring-null-value-s-when-parsing-JSO...

 

View solution in original post

2 REPLIES 2
Resolver I
Resolver I

Could you share a set of sample data for us to test?

 

Also specific configuration of your Flow, it is best to have screenshots.

 

Maybe we can parse JSON Response by other ways.

Hi, 

thank you for stepping in.

I won't be able to post the specific json as it is very large. 

In the meanwhile I've found a suggestion to add null value to the list of allowed types like this:

 

"CompanyName": {
"type": [
"string",
"null"
]
or this:
 
"Expressions": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "AttributeID": {},
                                "AttributeName": {
                                    "type": [
                                        "string",
                                        "null",
                                        "integer"
                                    ]
                                },
                                "Operator": {
                                    "type": "string"
                                },
                                "Value": {
                                    "type": [
                                        "string",
                                        "null",
                                        "integer"
                                    ]
                                }
                            },

I've taken it one step further and added other types to the list so both integer and string would be accepted and this seems to be working.

 

Thanks to @Ben_Love!

Solution found here : https://powerusers.microsoft.com/t5/Building-Flows/parse-JSON-Ignoring-null-value-s-when-parsing-JSO...

 

View solution in original post

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (6,564)