cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kazssym
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
kazssym
Frequent Visitor

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

View solution in original post

5 REPLIES 5
v-micsh-msft
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
}

kazssym
Frequent Visitor

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
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (55,573)