Skip to content

Calling One Azure Logic App Workflow from Another to prevent JSON being escaped

February 21, 2025

Have you ever composed JSON in an activity, only to find that it gets all tangled up when you try to use it as the body in another workflow? It’s frustrating, right?

When you put the JSON in the designer interface as the body, it gets escaped, transforming into a string with all { and " replaced with \{ and \". However, there’s a simple solution to this problem: editing the inner code.

By default, you will see something like this:

{
    "Invoke_a_workflow_in_this_workflow_app_-child workflow ": {
        "type": "Workflow",
        "inputs": {
            "host": {
                "workflow": {
                    "id": "child workflow name"
                }
            },
            "body": "@{outputs('Compose_JSON_body')}"
        },
        "runAfter": {
            "Compose_JSON_body": [
                "SUCCEEDED"
            ]
        }
    }
}

Notice the extra braces in @{outputs('Compose_JSON_body')}. You need to replace it with @outputs('Compose_JSON_body')—without the braces.

The resulting code should look like this:

{
    "Invoke_a_workflow_in_this_workflow_app_-child workflow ": {
        "type": "Workflow",
        "inputs": {
            "host": {
                "workflow": {
                    "id": "child workflow name"
                }
            },
            "body": "@outputs('Compose_JSON_body')"
        },
        "runAfter": {
            "Compose_JSON_body": [
                "SUCCEEDED"
            ]
        }
    }
}

By making this small edit, you ensure that the JSON is correctly interpreted and passed to the inner workflow without any unwanted escaping.

From → Azure, Logic Apps

Leave a Comment

Leave a comment