cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ALPetersen
New Member

Power Automate Desktop Extract null from JsonAsCustomObject

Using action "Invoke Web Service", i'm returned a JSON output (works fine..)

In the end, the data is to be inserted in a SQL database, so using action "Convert JSON to Custom Object", i'm turning the JSON into a custom object.

 

My data now looks like this:

{
"name": "Donald Duck",
"isCompany": "",
"vatNumber": "",
"cellPhoneNumber": "",
"phoneNumber": "",
"email": "",
"comment": "",
"categoryReference": {
"name": "",
"id": "3000",
"externalId": "3000"
},
"billingAddress": {

.... rest of data is cut off and not included in this post

 

On my way towards the SQL insert, i am using action "Set Variable" = '%JsonAsCustomObject.name%' (which works fine, the variable is set correctly to "Donald Duck")

but..

Using action "Set Variable" = '%JsonAsCustomObject.email%' will returns this error: "Variable 'JsonAsCustomObject' doesn't have a property 'email'."

 

How do i get to the point where i can make PAD understand to pick up the value "NULL" or "BLANK" when my Custom Object does not hold a value ?

 

 

 

4 REPLIES 4
PetrosF-MSFT
Microsoft
Microsoft

Hi @ALPetersen 

 

I tried it with the latest version, and looks like it picks the blank value successfully.

 

Could you check with the latest one?

 

Download link: Power Automate Desktop Use desktop flows to automate actions and business processes on your desktop ...

Fjalar
Frequent Visitor

I am also hitting this roadblock. Was there a solution or a proper way to address this that you found @ALPetersen ?

 

Also the message stating that a variable "doesn't have a property" is not correct in my case. It has the property but the property is null. What I try to do is to catch these cases with an IF (empty) and set it to 0 or something but same result 😕

Fjalar_0-1617799520719.png

 

Fjalar_1-1617799618902.png

 

I am not posting anything sensitive here. Just info on a gas station and current prices 🙂 

 

 





CesarRamirez
Helper I
Helper I

Hi @ALPetersen 
To solve this I used a "Replace text" action before "Convert JSON to custom object" action, where replace all null to empty text, see below the actions and configuration used:

CesarRamirez_2-1617834866445.png

CesarRamirez_1-1617834734675.png

I hope the solution works for you.

Best regards.

Thanks @CesarRamirez . This is indeed a solution to this task. Hopefully the Convert JSON to custom object action will be updated to handle null values better in future updates 🙂 

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (52,285)