web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to handle Properti...
Power Automate
Unanswered

How to handle Properties that are not presented every time within JSON

(0) ShareShare
ReportReport
Posted on by 83

Desired workflow: Wanting to setup a reoccurring flow to pull Actions from iAuditor on a once an hour interval and only pull actions which were modified from the last time the flow ran, then write the Action data to an Office365 excel table (eventually SQL/NOSQL DB, haven't explored these options yet). 

 

Problem I'm trying to solve: . I'm pulling the body of the HTTP request into the parse JSON feature then including 'null' as a possible value (see schema below). However, there are times when the Action body doesn't contain every properties within the 'item' object. So when the expression is used to look at a property within the 'item' object it fails due to the property not being present. 

 

Answer I'm Seeking: How do I write an expression to ignore a property if it's not present?  

 

  • Expression being used where Property is missing and can't be evaluated. 

 

 

body('Action_Data')?['item']?['item_id']

 

 

 

Screenshots of the flow. (Remember, I'm good up to the point of Parse JSON and Writing to table, please ignore the manual steps in the beginning, as this will be changed automation once back half of the flow works)

 

Overview:

 

Flow Overview.png

 

HTTP Request

 

HTTP Request.png

 

Parse JSON

 

Parse HTTP Body.png

 

Output to Excel 

 

Excel Output.png

 

JSON with Item Object

 

 

 

{
 "type": "action",
 "action_id": "action_39f98c6947f3406c86f1b0a4da617f8f",
 "template_id": "template_<id>",
 "audit": {
 "audit_id": "audit_ef764ae7c04647a0af7167bfe526fd05",
 "name": "Monthly Safety Inspection "
 },
 "item": {
 "item_id": "A680CBBE-3ED8-4BB4-B3E9-99A3AF3FB771-1425-00000049B211E704",
 "label": "4.8 - Furniture / Fixtures in sound condition?"
 },
 "title": "The cover for the fan has falling off. It needs to be repair ASAP.",
 "site": "LOS ANGELES",
 "description": "This is the description field",
 "priority": 10,
 "status": 0,
 "assignees": [
 {
 "id": "user_<id>",
 "name": "First Last Name",
 "type": "user"
 }
 ],
 "created_by": {
 "user_id": "user_<id>",
 "name": "First Last Name"
 },
 "created_at": "2020-03-26T14:41:39.502Z",
 "modified_at": "2020-03-26T14:41:39.502Z",
 "due_at": "2020-04-02T15:00:00.000Z"
}

 

 

 

JSON without Item Object

 

 

{
 "type": "action",
 "action_id": "action_437d15c905064a9d93d7ba2d5a20b304",
 "template_id": "",
 "audit": {
 "audit_id": "",
 "name": ""
 },
 "item": null,
 "title": "Test",
 "site": "",
 "description": "Test",
 "priority": 10,
 "status": 0,
 "assignees": [],
 "created_by": {
 "user_id": "user_135d809be1cb43508bc17439f2ea5a69",
 "name": "Joshua Yeamans 000099172"
 },
 "created_at": "2020-04-28T21:01:13.000Z",
 "modified_at": "2020-04-28T21:01:13.000Z",
 "due_at": "2020-05-05T21:01:13.000Z"
}

 

 

 

JSON with Parse JSON Schema

 

 

 

{
 "type": "object",
 "properties": {
 "type": {
 "type": "string"
 },
 "action_id": {
 "type": "string"
 },
 "template_id": {
 "type": [ "string","null"]
 },
 "audit": {
 "type": "object",
 "properties": {
 "audit_id": {
 "type": [
 "string",
 "null"
 ]
 },
 "name": {
 "type": [
 "string",
 "null"
 ]
 }
 }
 },
 "item": {
 "type": ["object", "null"],
 "properties": {
 "item_id": {
 "type": [
 "string",
 "null"
 ]
 },
 "label": {
 "type": [
 "string",
 "null"
 ]
 }
 }
 },
 "title": {
 "type": [
 "string",
 "null"
 ]
 },
 "site": {
 "type": [
 "string",
 "null"
 ]
 },
 "description": {
 "type": [
 "string",
 "null"
 ]
 },
 "priority": {
 "type": "integer"
 },
 "status": {
 "type": "integer"
 },
 "assignees": {
 "type": "array",
 "items": {
 "type": ["object", "null"],
 "properties": {
 "id": {
 "type": [
 "string",
 "null"
 ]
 },
 "name": {
 "type": [
 "string",
 "null"
 ]
 },
 "type": {
 "type": [
 "string",
 "null"
 ]
 }
 },
 "required": []
 }
 },
 "created_by": {
 "type": "object",
 "properties": {
 "user_id": {
 "type": [
 "string",
 "null"
 ]
 },
 "name": {
 "type": [
 "string",
 "null"
 ]
 }
 }
 },
 "created_at": {
 "type": [
 "string",
 "null"
 ]
 },
 "modified_at": {
 "type": [
 "string",
 "null"
 ]
 },
 "due_at": {
 "type": [
 "string",
 "null"
 ]
 }
 }
}

 

 

 

Categories:
  • efialttes Profile Picture
    14,756 on at

    Hi!

    So the expression that is failing....

    body('Action_Data')?['item']?['item_id']

    ... is it because item is null? Or because item_id is null?

    Thanx!

     

  • yeamans Profile Picture
    83 on at

    @efialttes  Thank you so much for the quick response!!!

     

    Here's the exact error:

     

    InvalidTemplate. Unable to process template language expressions in action 'Add_a_row_into_a_table' inputs at line '1' and column '2235': 'The template language expression 'empty(body('Action_Data')['item']['item_id'])' cannot be evaluated because property 'item_id' cannot be selected. Please see https://aka.ms/logicexpressions for usage details.'.

     

    Then here's the object I'm looking at when parsing the JSON:

    When the Item Properties are Present:

    "item": {
     "item_id": "A680CBBE-3ED8-4BB4-B3E9-99A3AF3FB771-1425-00000049B211E704",
     "label": "4.8 - Furniture / Fixtures in sound condition?"
     },

     When the Item Property isn't Present:

    "item": null,
     

     

     

  • efialttes Profile Picture
    14,756 on at

    Hi!

    Did you consider trying first...

    empty(body('Action_Data')['item'])

    If false then Parse JSON

    empty(body('Action_Data')['item']

     

    Not with my laptop, unable to test

    Thanx!

  • yeamans Profile Picture
    83 on at
    @efialttesare you talking about an expression like this one? 
     
    if(empty(body('Action_Data')['item']),'empty',body('Action_Data')['item']['item_id'])
  • yeamans Profile Picture
    83 on at

    @efialttes BOOM! That worked 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 424

#2
11manish Profile Picture

11manish 328 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard