cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
in2217
Level 8

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
in2217
Level 8

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
RookieI
Level: Powered On

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.

in2217
Level 8

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

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

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!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors
Users online (4,832)