I'm trying to parse JSON content whose type is not application/json with a Parse JSON step but I only got errors. Is there any way to process such content as application/json?
For your information, the content type really is application/csp-report.
Solved! Go to Solution.
FYI, I finally solved this issue by passing "@json(string(triggerBody()))" to Parse JSON.
Hi @kazssym,
Would you please share the error message here?
What is the schema you have defined under the Parse JSON action?
Have you tried the Use sample payload button?
I am not very familar with that part.
Maybe Staff @masisley could help on this topic.
Regards,
Michael
Every run stopped with the following error:
BadRequest. The property 'content' must be of type JSON in the 'ParseJson' action inputs, but was of type 'application/csp-report'.
The JSON schema I use is this one:
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "JSON Schema for Content Security Policy (Level 2) violation reports",
"description": "https://www.w3.org/TR/CSP2/#violation-reports",
"type": "object",
"required": [
"csp-report"
],
"properties": {
"csp-report": {
"type": "object",
"properties": {
"blocked-uri": {
"type": "string",
"description": "The originally requested URL of the resource that was prevented from loading, stripped for reporting, or the empty string if the resource has no URL (inline script and inline style, for example)."
},
"document-uri": {
"type": "string",
"description": "The address of the protected resource, stripped for reporting."
},
"effective-directive": {
"type": "string",
"description": "The name of the policy directive that was violated. This will contain the directive whose enforcement triggered the violation (e.g. \"script-src\") even if that directive does not explicitly appear in the policy, but is implicitly activated via the default-src directive."
},
"original-policy": {
"type": "string",
"description": "The original policy, as received by the user agent."
},
"referrer": {
"type": "string",
"description": "The referrer attribute of the protected resource, or the empty string if the protected resource has no referrer."
},
"status-code": {
"type": "number",
"description": "The status-code of the HTTP response that contained the protected resource, if the protected resource was obtained over HTTP. Otherwise, the number 0."
},
"violated-directive": {
"type": "string",
"description": "The policy directive that was violated, as it appears in the policy. This will contain the default-src directive in the case of violations caused by falling back to the default sources when enforcing a directive."
},
"source-file": {
"type": "string",
"description": "The URL of the resource where the violation occurred, stripped for reporting."
},
"line-number": {
"type": "number",
"description": "The line number in source-file on which the violation occurred."
},
"column-number": {
"type": "number",
"description": "The column number in source-file on which the violation occurred."
}
}
}
},
"additionalProperties": false
}
FYI, I finally solved this issue by passing "@json(string(triggerBody()))" to Parse JSON.
Where you passed it?
I've done as this.
Check out new user group experience and if you are a leader please create your group
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.