cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Resolver I
Resolver I

Re: Parsing http response body: template

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
Highlighted
Resolver I
Resolver I

Re: Parsing http response body: template

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.

Highlighted
Resolver I
Resolver I

Re: Parsing http response body: template

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
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (8,172)