cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Handling Null's in JSON

 

Hi all,

 

I've created a flow to get JSON data from a HTTP GET request. 

My JSON can contain NULL vallues, and the string type in JSON won't accept these null values. I tried to fix it with emtpy brackets:

     "displayName":  {},
     "givenName":  {}
 
The flow works perfectly, but when I try to add the flow in PowerApps I get the error: "Registering Error", because of the empty brackets instead of a datatype. 
Anyone knows how I can convert these nulls to empty strings in flow, or workaround this issue? 
 
my flow:

Untitled.png

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Hi, thanks for the reply.


I've fixed the problem by adding two 'initialize variable' components between the HTTP GET & the 'Parse JSON' component. 

 

- one that transforms the body of the http to string: string(body('HTTP'))

- one that replace the nulls in the string created in the step above:  replace(variables('varHTTPstring'), 'null', '""')

 

removenulls.png

View solution in original post

2 REPLIES 2
v-alzhan-msft
Community Support
Community Support

Hi @Anonymous ,

 

I have made a test on my side and couldn't find the solution, I'm afraid that there is no any way to convert nulls to empty strings JSON in microsoft flow currently.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi, thanks for the reply.


I've fixed the problem by adding two 'initialize variable' components between the HTTP GET & the 'Parse JSON' component. 

 

- one that transforms the body of the http to string: string(body('HTTP'))

- one that replace the nulls in the string created in the step above:  replace(variables('varHTTPstring'), 'null', '""')

 

removenulls.png

View solution in original post

Helpful resources

Announcements
Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,388)