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

"PARSE JSON" action fails to accept very data it used and approved to build the schema.

I am trying to use the "PARSE JSON" action to parse incoming JSON data from an API.  I took incoming JSON and used it to "generate" its own schema which is an available option in the action.  However, it seems to reject the identical JSON it considered valid enough to build a schema.  The error is : "The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value 'Parse ACES Export JSON' cannot be parsed: 'Unexpected character encountered while parsing value: P. Path '', line 0, position 0.'.

 

Here is the source JSON (Edited to remove sensitive data) which was the exact JSON used to generate schema:

 

 

 

 

{
    "statusCode": 200,
    "headers": {
        "Pragma": "public",
        "Transfer-Encoding": "chunked",
        "Vary": "Authorization,User-Agent",
        "Strict-Transport-Security": "max-age=31536000; includeSubdomains;",
        "X-Content-Type-Options": "nosniff",
        "Cache-Control": "must-revalidate, post-check=0, pre-check=0",
        "Date": "Fri, 25 Sep 2020 17:19:27 GMT",
        "Content-Type": "application/json",
        "Expires": "0",
        "Content-Length": "31687"
    },
    "body": {
        "title": "aces_export",
        "fields": [
            {
                "id": "employeeNumber",
                "type": "employee_number",
                "name": "reference_number"
            },
            {
                "id": "workEmail",
                "type": "email",
                "name": "email"
            },
            {
                "id": "firstName",
                "type": "text",
                "name": "first_name"
            },
            {
                "id": "lastName",
                "type": "text",
                "name": "last_name"
            },
            {
                "id": "gender",
                "type": "gender",
                "name": "gender"
            },
            {
                "id": "supervisorId",
                "type": "text",
                "name": "approver"
            },
            {
                "id": "terminationDate",
                "type": "date",
                "name": "leaving_date"
            },
            {
                "id": "department",
                "type": "list",
                "name": "department"
            },
            {
                "id": "division",
                "type": "list",
                "name": "division"
            },
            {
                "id": "jobTitle",
                "type": "list",
                "name": "job_title"
            }
        ],
        "employees": [
            {
                "id": "200",
                "employeeNumber": "5340",
                "workEmail": "bob@apple.com",
                "firstName": "Bob",
                "lastName": "Barker",
                "gender": "Male",
                "supervisorId": "5154",
                "terminationDate": "0000-00-00",
                "department": "Broadcast",
                "division": "GameShow",
                "jobTitle": "Host"
            }
        ]
    }
}

 

 

and here is the schema that is generated by PARSE JSON:

 

 

        "statusCode": {
            "type": "integer"
        },
        "headers": {
            "type": "object",
            "properties": {
                "Pragma": {
                    "type": "string"
                },
                "Transfer-Encoding": {
                    "type": "string"
                },
                "Vary": {
                    "type": "string"
                },
                "Strict-Transport-Security": {
                    "type": "string"
                },
                "X-Content-Type-Options": {
                    "type": "string"
                },
                "Cache-Control": {
                    "type": "string"
                },
                "Date": {
                    "type": "string"
                },
                "Content-Type": {
                    "type": "string"
                },
                "Expires": {
                    "type": "string"
                },
                "Content-Length": {
                    "type": "string"
                }
            }
        },
        "body": {
            "type": "object",
            "properties": {
                "title": {
                    "type": "string"
                },
                "fields": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "type": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "id",
                            "type",
                            "name"
                        ]
                    }
                },
                "employees": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "employeeNumber": {
                                "type": "string"
                            },
                            "workEmail": {
                                "type": "string"
                            },
                            "firstName": {
                                "type": "string"
                            },
                            "lastName": {
                                "type": "string"
                            },
                            "gender": {
                                "type": "string"
                            },
                            "supervisorId": {
                                "type": "string"
                            },
                            "terminationDate": {
                                "type": "string"
                            },
                            "department": {
                                "type": "string"
                            },
                            "division": {
                                "type": "string"
                            },
                            "jobTitle": {
                                "type": "string"
                            }
                        },
                        "required": [
                            "id",
                            "employeeNumber",
                            "workEmail",
                            "firstName",
                            "lastName",
                            "gender",
                            "supervisorId",
                            "terminationDate",
                            "department",
                            "division",
                            "jobTitle"
                        ]
                    }
                }
            }
        }
    }
}

 

 

 

 

 

Any help would be appreciated.   I also would like help understanding what is being referred to by "P. Path '', line 0, position 0.'."" would be helpful.

 

Thank You

2 REPLIES 2
Mira_Ghaly
Dual Super User II
Dual Super User II

@Bourmatnov 

Please use the below schema

I made a test on your supplied JSON above with the below Schema and it worked fine

{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "http://example.com/example.json",
    "type": "object",
    "title": "The root schema",
    "description": "The root schema comprises the entire JSON document.",
    "default": {},
    "examples": [
        {
            "statusCode": 200,
            "headers": {
                "Pragma": "public",
                "Transfer-Encoding": "chunked",
                "Vary": "Authorization,User-Agent",
                "Strict-Transport-Security": "max-age=31536000; includeSubdomains;",
                "X-Content-Type-Options": "nosniff",
                "Cache-Control": "must-revalidate, post-check=0, pre-check=0",
                "Date": "Fri, 25 Sep 2020 17:19:27 GMT",
                "Content-Type": "application/json",
                "Expires": "0",
                "Content-Length": "31687"
            },
            "body": {
                "title": "aces_export",
                "fields": [
                    {
                        "id": "employeeNumber",
                        "type": "employee_number",
                        "name": "reference_number"
                    },
                    {
                        "id": "workEmail",
                        "type": "email",
                        "name": "email"
                    },
                    {
                        "id": "firstName",
                        "type": "text",
                        "name": "first_name"
                    },
                    {
                        "id": "lastName",
                        "type": "text",
                        "name": "last_name"
                    },
                    {
                        "id": "gender",
                        "type": "gender",
                        "name": "gender"
                    },
                    {
                        "id": "supervisorId",
                        "type": "text",
                        "name": "approver"
                    },
                    {
                        "id": "terminationDate",
                        "type": "date",
                        "name": "leaving_date"
                    },
                    {
                        "id": "department",
                        "type": "list",
                        "name": "department"
                    },
                    {
                        "id": "division",
                        "type": "list",
                        "name": "division"
                    },
                    {
                        "id": "jobTitle",
                        "type": "list",
                        "name": "job_title"
                    }
                ],
                "employees": [
                    {
                        "id": "200",
                        "employeeNumber": "5340",
                        "workEmail": "bob@apple.com",
                        "firstName": "Bob",
                        "lastName": "Barker",
                        "gender": "Male",
                        "supervisorId": "5154",
                        "terminationDate": "0000-00-00",
                        "department": "Broadcast",
                        "division": "GameShow",
                        "jobTitle": "Host"
                    }
                ]
            }
        }
    ],
    "required": [
        "statusCode",
        "headers",
        "body"
    ],
    "properties": {
        "statusCode": {
            "$id": "#/properties/statusCode",
            "type": "integer",
            "title": "The statusCode schema",
            "description": "An explanation about the purpose of this instance.",
            "default": 0,
            "examples": [
                200
            ]
        },
        "headers": {
            "$id": "#/properties/headers",
            "type": "object",
            "title": "The headers schema",
            "description": "An explanation about the purpose of this instance.",
            "default": {},
            "examples": [
                {
                    "Pragma": "public",
                    "Transfer-Encoding": "chunked",
                    "Vary": "Authorization,User-Agent",
                    "Strict-Transport-Security": "max-age=31536000; includeSubdomains;",
                    "X-Content-Type-Options": "nosniff",
                    "Cache-Control": "must-revalidate, post-check=0, pre-check=0",
                    "Date": "Fri, 25 Sep 2020 17:19:27 GMT",
                    "Content-Type": "application/json",
                    "Expires": "0",
                    "Content-Length": "31687"
                }
            ],
            "required": [
                "Pragma",
                "Transfer-Encoding",
                "Vary",
                "Strict-Transport-Security",
                "X-Content-Type-Options",
                "Cache-Control",
                "Date",
                "Content-Type",
                "Expires",
                "Content-Length"
            ],
            "properties": {
                "Pragma": {
                    "$id": "#/properties/headers/properties/Pragma",
                    "type": "string",
                    "title": "The Pragma schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "public"
                    ]
                },
                "Transfer-Encoding": {
                    "$id": "#/properties/headers/properties/Transfer-Encoding",
                    "type": "string",
                    "title": "The Transfer-Encoding schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "chunked"
                    ]
                },
                "Vary": {
                    "$id": "#/properties/headers/properties/Vary",
                    "type": "string",
                    "title": "The Vary schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "Authorization,User-Agent"
                    ]
                },
                "Strict-Transport-Security": {
                    "$id": "#/properties/headers/properties/Strict-Transport-Security",
                    "type": "string",
                    "title": "The Strict-Transport-Security schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "max-age=31536000; includeSubdomains;"
                    ]
                },
                "X-Content-Type-Options": {
                    "$id": "#/properties/headers/properties/X-Content-Type-Options",
                    "type": "string",
                    "title": "The X-Content-Type-Options schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "nosniff"
                    ]
                },
                "Cache-Control": {
                    "$id": "#/properties/headers/properties/Cache-Control",
                    "type": "string",
                    "title": "The Cache-Control schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "must-revalidate, post-check=0, pre-check=0"
                    ]
                },
                "Date": {
                    "$id": "#/properties/headers/properties/Date",
                    "type": "string",
                    "title": "The Date schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "Fri, 25 Sep 2020 17:19:27 GMT"
                    ]
                },
                "Content-Type": {
                    "$id": "#/properties/headers/properties/Content-Type",
                    "type": "string",
                    "title": "The Content-Type schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "application/json"
                    ]
                },
                "Expires": {
                    "$id": "#/properties/headers/properties/Expires",
                    "type": "string",
                    "title": "The Expires schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "0"
                    ]
                },
                "Content-Length": {
                    "$id": "#/properties/headers/properties/Content-Length",
                    "type": "string",
                    "title": "The Content-Length schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "31687"
                    ]
                }
            },
            "additionalProperties": true
        },
        "body": {
            "$id": "#/properties/body",
            "type": "object",
            "title": "The body schema",
            "description": "An explanation about the purpose of this instance.",
            "default": {},
            "examples": [
                {
                    "title": "aces_export",
                    "fields": [
                        {
                            "id": "employeeNumber",
                            "type": "employee_number",
                            "name": "reference_number"
                        },
                        {
                            "id": "workEmail",
                            "type": "email",
                            "name": "email"
                        },
                        {
                            "id": "firstName",
                            "type": "text",
                            "name": "first_name"
                        },
                        {
                            "id": "lastName",
                            "type": "text",
                            "name": "last_name"
                        },
                        {
                            "id": "gender",
                            "type": "gender",
                            "name": "gender"
                        },
                        {
                            "id": "supervisorId",
                            "type": "text",
                            "name": "approver"
                        },
                        {
                            "id": "terminationDate",
                            "type": "date",
                            "name": "leaving_date"
                        },
                        {
                            "id": "department",
                            "type": "list",
                            "name": "department"
                        },
                        {
                            "id": "division",
                            "type": "list",
                            "name": "division"
                        },
                        {
                            "id": "jobTitle",
                            "type": "list",
                            "name": "job_title"
                        }
                    ],
                    "employees": [
                        {
                            "id": "200",
                            "employeeNumber": "5340",
                            "workEmail": "bob@apple.com",
                            "firstName": "Bob",
                            "lastName": "Barker",
                            "gender": "Male",
                            "supervisorId": "5154",
                            "terminationDate": "0000-00-00",
                            "department": "Broadcast",
                            "division": "GameShow",
                            "jobTitle": "Host"
                        }
                    ]
                }
            ],
            "required": [
                "title",
                "fields",
                "employees"
            ],
            "properties": {
                "title": {
                    "$id": "#/properties/body/properties/title",
                    "type": "string",
                    "title": "The title schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": "",
                    "examples": [
                        "aces_export"
                    ]
                },
                "fields": {
                    "$id": "#/properties/body/properties/fields",
                    "type": "array",
                    "title": "The fields schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": [],
                    "examples": [
                        [
                            {
                                "id": "employeeNumber",
                                "type": "employee_number",
                                "name": "reference_number"
                            },
                            {
                                "id": "workEmail",
                                "type": "email",
                                "name": "email"
                            }
                        ]
                    ],
                    "additionalItems": true,
                    "items": {
                        "$id": "#/properties/body/properties/fields/items",
                        "anyOf": [
                            {
                                "$id": "#/properties/body/properties/fields/items/anyOf/0",
                                "type": "object",
                                "title": "The first anyOf schema",
                                "description": "An explanation about the purpose of this instance.",
                                "default": {},
                                "examples": [
                                    {
                                        "id": "employeeNumber",
                                        "type": "employee_number",
                                        "name": "reference_number"
                                    }
                                ],
                                "required": [
                                    "id",
                                    "type",
                                    "name"
                                ],
                                "properties": {
                                    "id": {
                                        "$id": "#/properties/body/properties/fields/items/anyOf/0/properties/id",
                                        "type": "string",
                                        "title": "The id schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "employeeNumber"
                                        ]
                                    },
                                    "type": {
                                        "$id": "#/properties/body/properties/fields/items/anyOf/0/properties/type",
                                        "type": "string",
                                        "title": "The type schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "employee_number"
                                        ]
                                    },
                                    "name": {
                                        "$id": "#/properties/body/properties/fields/items/anyOf/0/properties/name",
                                        "type": "string",
                                        "title": "The name schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "reference_number"
                                        ]
                                    }
                                },
                                "additionalProperties": true
                            }
                        ]
                    }
                },
                "employees": {
                    "$id": "#/properties/body/properties/employees",
                    "type": "array",
                    "title": "The employees schema",
                    "description": "An explanation about the purpose of this instance.",
                    "default": [],
                    "examples": [
                        [
                            {
                                "id": "200",
                                "employeeNumber": "5340",
                                "workEmail": "bob@apple.com",
                                "firstName": "Bob",
                                "lastName": "Barker",
                                "gender": "Male",
                                "supervisorId": "5154",
                                "terminationDate": "0000-00-00",
                                "department": "Broadcast",
                                "division": "GameShow",
                                "jobTitle": "Host"
                            }
                        ]
                    ],
                    "additionalItems": true,
                    "items": {
                        "$id": "#/properties/body/properties/employees/items",
                        "anyOf": [
                            {
                                "$id": "#/properties/body/properties/employees/items/anyOf/0",
                                "type": "object",
                                "title": "The first anyOf schema",
                                "description": "An explanation about the purpose of this instance.",
                                "default": {},
                                "examples": [
                                    {
                                        "id": "200",
                                        "employeeNumber": "5340",
                                        "workEmail": "bob@apple.com",
                                        "firstName": "Bob",
                                        "lastName": "Barker",
                                        "gender": "Male",
                                        "supervisorId": "5154",
                                        "terminationDate": "0000-00-00",
                                        "department": "Broadcast",
                                        "division": "GameShow",
                                        "jobTitle": "Host"
                                    }
                                ],
                                "required": [
                                    "id",
                                    "employeeNumber",
                                    "workEmail",
                                    "firstName",
                                    "lastName",
                                    "gender",
                                    "supervisorId",
                                    "terminationDate",
                                    "department",
                                    "division",
                                    "jobTitle"
                                ],
                                "properties": {
                                    "id": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/id",
                                        "type": "string",
                                        "title": "The id schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "200"
                                        ]
                                    },
                                    "employeeNumber": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/employeeNumber",
                                        "type": "string",
                                        "title": "The employeeNumber schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "5340"
                                        ]
                                    },
                                    "workEmail": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/workEmail",
                                        "type": "string",
                                        "title": "The workEmail schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "bob@apple.com"
                                        ]
                                    },
                                    "firstName": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/firstName",
                                        "type": "string",
                                        "title": "The firstName schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "Bob"
                                        ]
                                    },
                                    "lastName": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/lastName",
                                        "type": "string",
                                        "title": "The lastName schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "Barker"
                                        ]
                                    },
                                    "gender": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/gender",
                                        "type": "string",
                                        "title": "The gender schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "Male"
                                        ]
                                    },
                                    "supervisorId": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/supervisorId",
                                        "type": "string",
                                        "title": "The supervisorId schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "5154"
                                        ]
                                    },
                                    "terminationDate": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/terminationDate",
                                        "type": "string",
                                        "title": "The terminationDate schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "0000-00-00"
                                        ]
                                    },
                                    "department": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/department",
                                        "type": "string",
                                        "title": "The department schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "Broadcast"
                                        ]
                                    },
                                    "division": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/division",
                                        "type": "string",
                                        "title": "The division schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "GameShow"
                                        ]
                                    },
                                    "jobTitle": {
                                        "$id": "#/properties/body/properties/employees/items/anyOf/0/properties/jobTitle",
                                        "type": "string",
                                        "title": "The jobTitle schema",
                                        "description": "An explanation about the purpose of this instance.",
                                        "default": "",
                                        "examples": [
                                            "Host"
                                        ]
                                    }
                                },
                                "additionalProperties": true
                            }
                        ]
                    }
                }
            },
            "additionalProperties": true
        }
    },
    "additionalProperties": true
}

 

If this post helps you with your problem, please mark your as Accepted solution.If you like my response, please give it a Thumbs Up.

Blog: here

Thanks, I think i might see the issue now.

 

Paul

 

 

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,487)