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

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How i can check if a property does not exists inside Parsed JSON file

(0) ShareShare
ReportReport
Posted on by 1,756 Super User 2024 Season 1

I am parsing a JSON list with this schema:-

 

{
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "Brand": {
 "type": [
 "string",
 "null"
 ]
 },
 "OOH_price_list": {
 "type": "object",
 "properties": {
 "Net_Total": {
 "type": [
 "string",
 "null"
 ]
 },
 "SalesTax": {},
 "Grand_Total": {
 "type": [
 "string",
 "null"
 ]
 },
 "Total": {
 "type": [
 "string",
 "null"
 ]
 },
 "DIscount": {
 "type": [
 "string",
 "null"
 ]
 }
 }
 },
 "BR_price_list": {
 "type": "object",
 "properties": {
 "Net_Total": {
 "type": [
 "string",
 "null"
 ]
 },
 "Grand_Total": {
 "type": [
 "string",
 "null"
 ]
 },
 "Amount_In_Words": {
 "type": [
 "string",
 "null"
 ]
 },
 "Sales_Tax": {
 "type": [
 "string",
 "null"
 ]
 }
 }
 },
 "OOH_media_list": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "Network": {
 "type": [
 "string",
 "null"
 ]
 },
 "Amount": {
 "type": [
 "string",
 "null"
 ]
 },
 "Duration": {
 "type": [
 "string",
 "null"
 ]
 },
 "of_Faces": {
 "type": [
 "string",
 "null"
 ]
 },
 "Start_Date": {
 "type": [
 "string",
 "null"
 ]
 },
 "End_Date": {
 "type": [
 "string",
 "null"
 ]
 },
 "Delivery Date": {
 "type": [
 "string",
 "null"
 ]
 }
 },
 "required": [
 "Network",
 "Amount",
 "Duration",
 "of_Faces",
 "Start_Date",
 "End_Date",
 "Delivery Date"
 ]
 }
 },
 "blue_river_list": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "Network": {
 "type": [
 "string",
 "null"
 ]
 },
 "Amount": {
 "type": [
 "string",
 "null"
 ]
 },
 "Cost_Face": {
 "type": [
 "string",
 "null"
 ]
 },
 "of_Faces": {
 "type": [
 "string",
 "null"
 ]
 },
 "Start_Date": {
 "type": [
 "string",
 "null"
 ]
 }
 },
 "required": [
 "Network",
 "Amount",
 "Cost_Face",
 "of_Faces",
 "Start_Date"
 ]
 }
 },
 "Contract_Number": {
 "type": [
 "string",
 "null"
 ]
 },
 "Client Name": {
 "type": [
 "string",
 "null"
 ]
 },
 "Sector": {
 "type": [
 "string",
 "null"
 ]
 },
 "No of Faces": {
 "type": [
 "string",
 "null"
 ]
 },
 "Sales Person Name": {
 "type": [
 "string",
 "null"
 ]
 },
 "Sales Person Email": {
 "type": [
 "string",
 "null"
 ]
 }
 },
 "required": [

 ]
 }
}

 

now i want to get the following property named "Grand_Total":-

 

if(empty(items('Apply_to_each')['OOH_price_list']),null,items('Apply_to_each')['OOH_price_list']['Grand_Total'])

 

but on some items i am getting this error:-

 

'if(empty(items('Apply_to_each')['OOH_price_list']),null,items('Apply_to_each')['OOH_price_list']['Grand_Total'])' cannot be evaluated because property 'OOH_price_list' doesn't exist, available properties are 'Brand, BR_price_list, OOH_media_list, Category, Sales Person Email, blue_river_list, Contract_Number, Client Name, Sector, No of Faces, Blue River, Sales Person Name'.

 

so how i can check if the OOH_price_list is there to get its properties? seems empty function will not work

I have the same question (0)
  • Verified answer
    DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at
    Re: How i can check if a property does not exists inside Parsed JSON file

    Hi @johnjohnPter 

    If you try to access the path like this:

    items('Apply_to_each')['OOH_price_list']['Grand_Total']


    It means, evaluate ['OOH_price_list'] because it is definitely there and evaluate ['Grand_Total'] because it is definitely there, so you will get an error if it's not there.

     

    If you access the path like this:

    items('Apply_to_each')?['OOH_price_list']?['Grand_Total']

     

    The question mark ? means evaluate if it's there.

     

    Try:

    if(
     equals(
     items('Apply_to_each')?['OOH_price_list']?['Grand_Total'],
     null
     ),
     null,
     items('Apply_to_each')?['OOH_price_list']?['Grand_Total']
    )
  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at
    Re: How i can check if a property does not exists inside Parsed JSON file

    @johnjohnPter  - Did it work??

    If so - can you mark as solution 😁

  • johnjohnPter Profile Picture
    1,756 Super User 2024 Season 1 on at
    Re: How i can check if a property does not exists inside Parsed JSON file

    @DJ_Jamba ok it worked

  • DJ_Jamba Profile Picture
    2,837 Super User 2025 Season 2 on at
    Re: How i can check if a property does not exists inside Parsed JSON file

    Good stuff - glad it worked!

    d(-_-)b

  • jrussi1301 Profile Picture
    38 on at
    How i can check if a property does not exists inside Parsed JSON file
    try:
     
    coalesce(items('Apply_to_each')?['OOH_price_list']?['Grand_Total'],null)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 535 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 348 Moderator

#3
developerAJ Profile Picture

developerAJ 262

Last 30 days Overall leaderboard