0

getting Error

\<!--                                                                        --\>

\<!-- \[                                                                         --\>

\<!--   {                                                                    --\>

\<!--     \`message\`: \`Invalid type. Expected Array but got Object.\`,             --\>

\<!--     \`lineNumber\`: 0,                                                     --\>

\<!--     \`linePosition\`: 0,                                                   --\>

\<!--     \`path\`: \`\[0\]\`,                                                       --\>

\<!--     \`schemaId\`: \`#/items\`,                                                 --\>

\<!--     \`errorType\`: \`type\`,                                               --\>

\<!--     \`childErrors\`: \[\]                                                  --\>

\<!--   }                                                                    --\>

\<!-- \]                                                                         --\>

\<!--                                                                        --\>

Schema i am using for parsejson is

\<!--                                                                        --\>

\<!-- {                                                                      --\>

\<!--     'items': {                                                             --\>

\<!--         'items': {                                                         --\>

\<!--             'properties': {                                            --\>

\<!--                 'AttachmentName': {                                    --\>

\<!--                     'type': 'string'                                   --\>

\<!--                 },                                                         --\>

\<!--                 'CopyFileFormat': {                                    --\>

\<!--                     'type': 'string'                                   --\>

\<!--                 },                                                         --\>

\<!--                 'EmailSubject': {                                      --\>

\<!--                     'type': 'string'                                   --\>

\<!--                 },                                                         --\>

\<!--                 'FromEmailDomain': {                                   --\>

\<!--                     'type': 'string'                                   --\>

\<!--                 },                                                         --\>

\<!--                 'copypath': {                                          --\>

\<!--                     'type': 'string'                                   --\>

\<!--                 }                                                      --\>

\<!--             },                                                             --\>

\<!--             'required': \[                                                 --\>

\<!--                 'EmailSubject',                                        --\>

\<!--                 'FromEmailDomain',                                         --\>

\<!--                 'AttachmentName',                                      --\>

\<!--                 'copypath',                                            --\>

\<!--                 'CopyFileFormat'                                       --\>

\<!--             \],                                                            --\>

\<!--             'type': 'array'                                            --\>

\<!--         },                                                                 --\>

\<!--         'type': 'array'                                                --\>

\<!--     },                                                                     --\>

\<!--     'type': 'array'                                                    --\>

\<!-- }                                                                      --\>

\<!--                                                                        --\>

Output from execute stored Procedure

\<!--                                                                        --\>

\<!-- {                                                                      --\>

\<!--   \`ResultSets\`: {                                                        --\>

\<!--     \`Table1\`: \[                                                         --\>

\<!--       {                                                                --\>

\<!--         \`EmailSubject\`: \`test Value\`,                                  --\>

\<!--         \`FromEmailDomain\`: \`gmail.com\`,                                --\>

\<!--         \`AttachmentName\`: \`test0804.PDF\`,                              --\>

\<!--         \`copypath\`: \`test\`,                                            --\>

\<!--         \`CopyFileFormat\`: \`202304.pdf\`                                     --\>

\<!--       }                                                                --\>

\<!--     \]                                                                     --\>

\<!--   },                                                                   --\>

\<!--   \`ReturnCode\`: 0,                                                       --\>

\<!--   \`OutputParameters\`: {}                                                 --\>

\<!-- }                                                                      --\>

What is wrong in ParseJson Schema ?

RithwikBojja
  • 5,069
  • 2
  • 3
  • 7

1 Answers1

0

I have reproduced in my environment and are the expected results:

Input:

{

    "ResultSets": {
        "Table1": [{

                "EmailSubject": "test Value",

                "FromEmailDomain": " gmail.com",

                "AttachmentName": " test0804.PDF",

                "copypath": "test",

                "CopyFileFormat": "202304. pdf"

            }

        ]

    },
    "ReturnCode": 0,

    "OutputParameters": {}

}

Design:

enter image description here

Parse_Json Schema:

{
    "type": "object",
    "properties": {
        "ResultSets": {
            "type": "object",
            "properties": {
                "Table1": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "EmailSubject": {
                                "type": "string"
                            },
                            "FromEmailDomain": {
                                "type": "string"
                            },
                            "AttachmentName": {
                                "type": "string"
                            },
                            "copypath": {
                                "type": "string"
                            },
                            "CopyFileFormat": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "EmailSubject",
                            "FromEmailDomain",
                            "AttachmentName",
                            "copypath",
                            "CopyFileFormat"
                        ]
                    }
                }
            }
        },
        "ReturnCode": {
            "type": "integer"
        },
        "OutputParameters": {
            "type": "object",
            "properties": {}
        }
    }
}

Output:

enter image description here

Codeview:

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "Initialize_variable": {
                "inputs": {
                    "variables": [
                        {
                            "name": "var1",
                            "type": "object",
                            "value": {
                                "OutputParameters": {},
                                "ResultSets": {
                                    "Table1": [
                                        {
                                            "AttachmentName": " test0804.PDF",
                                            "CopyFileFormat": "202304. pdf",
                                            "EmailSubject": "test Value",
                                            "FromEmailDomain": " gmail.com",
                                            "copypath": "test"
                                        }
                                    ]
                                },
                                "ReturnCode": 0
                            }
                        }
                    ]
                },
                "runAfter": {},
                "type": "InitializeVariable"
            },
            "Parse_JSON": {
                "inputs": {
                    "content": "@variables('var1')",
                    "schema": {
                        "properties": {
                            "OutputParameters": {
                                "properties": {},
                                "type": "object"
                            },
                            "ResultSets": {
                                "properties": {
                                    "Table1": {
                                        "items": {
                                            "properties": {
                                                "AttachmentName": {
                                                    "type": "string"
                                                },
                                                "CopyFileFormat": {
                                                    "type": "string"
                                                },
                                                "EmailSubject": {
                                                    "type": "string"
                                                },
                                                "FromEmailDomain": {
                                                    "type": "string"
                                                },
                                                "copypath": {
                                                    "type": "string"
                                                }
                                            },
                                            "required": [
                                                "EmailSubject",
                                                "FromEmailDomain",
                                                "AttachmentName",
                                                "copypath",
                                                "CopyFileFormat"
                                            ],
                                            "type": "object"
                                        },
                                        "type": "array"
                                    }
                                },
                                "type": "object"
                            },
                            "ReturnCode": {
                                "type": "integer"
                            }
                        },
                        "type": "object"
                    }
                },
                "runAfter": {
                    "Initialize_variable": [
                        "Succeeded"
                    ]
                },
                "type": "ParseJson"
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "parameters": {},
        "triggers": {
            "manual": {
                "inputs": {
                    "schema": {}
                },
                "kind": "Http",
                "type": "Request"
            }
        }
    },
    "parameters": {}
}
RithwikBojja
  • 5,069
  • 2
  • 3
  • 7