cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Parse JSON content whose type is not application/json, how?

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.

1 ACCEPTED SOLUTION

Accepted Solutions

FYI, I finally solved this issue by passing "@json(string(triggerBody()))" to Parse JSON.

View solution in original post

5 REPLIES 5
Community Support
Community Support

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?

Parse JSON messages

I am not very familar with that part.

Maybe Staff @masisley could help on this topic.

Regards,

Michael

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

View solution in original post

Anonymous
Not applicable

Where you passed it?

I've done as this.

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (13,331)