Azure Logic Apps: How to handle dynamic content in HTTP Request triggers?
I'm getting frustrated with I've been working on this all day and I've searched everywhere and can't find a clear answer. I've been struggling with this for a few days now and could really use some help. I'm currently working with Azure Logic Apps and trying to set up an HTTP Request trigger that will handle dynamic content from various sources. The goal is to extract specific fields from incoming JSON payloads which can vary significantly in structure. However, I'm running into issues when the expected fields are not present, leading to runtime failures. I set up the Logic App with an HTTP Request trigger and I've defined a schema that includes the fields I'm interested in. For example: ```json { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "details": { "type": "object", "properties": { "description": { "type": "string" }, "date": { "type": "string" } } } } } ``` Despite this, when I post a payload that is missing the `details` object, I get the behavior message: ``` "Invalid template. Unable to process template language expressions in action 'YourActionName' inputs at line '1' and column '123': 'The template language function 'json' invoked with a parameter that is not valid.'" ``` To handle this, I've tried adding a condition to check if the `details` object exists before trying to access its properties, but that doesn't seem to prevent the initial schema validation behavior. I also attempted using the `@if` expression to conditionally parse the JSON but Iβm unsure how to structure it correctly. Hereβs the expression I tried within the Logic App: ```json @if(contains(triggerBody(), 'details'), triggerBody()?['details'], null) ``` This still results in a failure in the Logic App. Iβve also looked into using a default value with the `coalesce` function, but it seems that it doesn't help in bypassing the initial schema validation. Can anyone suggest a robust way of handling this kind of scenario in Azure Logic Apps without causing execution failures due to missing fields? Any insights or examples would be greatly appreciated! I'm working on a application that needs to handle this. Any help would be greatly appreciated! This is for a web app running on CentOS. Could this be a known issue?