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

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

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...

 

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

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...

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow 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 Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 199 members 4,477 guests
Please welcome our newest community members: