JSON Parse Fail with Azure Automation output

HectorMH Jimenez 41 Reputation points
2022-04-19T16:42:02.933+00:00

the powershell output for the runbook on automation account is not a json , how can modify it to get it in json parse logic app connector?

194356-image.png

194248-pic1.png194328-pic-2.jpg194340-pic5.png194329-pic4-li.jpg

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

Answer accepted by question author
  1. MayankBargali-MSFT 70,986 Reputation points Moderator
    2022-04-22T04:20:50.443+00:00

    @HectorMH Jimenez Thanks for reaching out. As per the output below I can see that the output field is not a valid JSON as you can see.
    Account: value
    Environment: value
    ...

    195413-image.png

    Further looking into your second screenshot that you have shared I can see the output is text value and looks like it has the valid JSON section (yellow highlighted text) inside the array value.
    The starting text (red highlighted text) is not a valid JSON and when you use Parse JSON action then it fails as expected as your output is not valid JSON object.

    195452-image.png

    To make your output as the valid JSON object either you need to update the job and it should only return the valid JSON text (yellow highlighted text).

    In case if you are not able to return the valid JSON object from your job then you can either leverage the split function to split your text and get the yellow highlighted text and then pass the right JSON object to your Parse JSON action. Alternatively, you can leverage the inline function and write the regular expression to get the right JSON value content.

    Feel free to get back to me if you have any queries or concerns.


1 additional answer

Sort by: Most helpful
  1. Andrew Blumhardt 10,071 Reputation points Microsoft Employee
    2022-04-19T16:51:13.003+00:00

    I have not worked specifically with these connector activities. A few tips that may help:

    Most of the activities produce JSON output and all expect JSON input. You can see the JSON output in the run logs. Errors related to JSON formatting are often a generic reference to a configuration error in the preceding activity. This could be misinterpreted as the need for a JSON parser. I would take a closer look at the "Get Job Output" config and logs.

    As you may know, the template for a JSON parser can be taken from the output of the previous activity. Usually, the only time you need a JSON parser is following a generic HTTP request activity. Are you sure you need a JSON parser? Maybe there is an issue with the runbook?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.