arraysjsonazure-data-factory

Getting "Malformed records are detected in schema inference" when trying to flatten JSON using a data flow in ADF


Using Azure Data Factory, I've copied data from an open-source API that requires no authorisation (https://directory.spineservices.nhs.uk/ORD/2-0-0/organisations/rxl) and put into into an Azure blob storage account as a JSON file. Now I'm trying to flatten some columns in a data flow but I'm having issues with my source activity. When I try to preview the data, I'm getting this error:

Malformed records are detected in schema inference. Parse Mode: FAILFAST. It could be because of a wrong selection in document form to parse json file(s). Please try a different 'Document form' (Single document/Document per line/Array of documents) on the json source.

I have tried changing the 'Document form' option to every option and I'm still getting the same error.

I can preview the data ok when looking at the dataset. But I can't look at it in the data flow... Any help appreciated!

Thanks.

Here is a sample of the data:

[
    {
        "Organisation": {
            "Rels": {
                "Rel": [
                    {
                        "Date": [
                            {
                                "Start": "2020-04-01",
                                "Type": "Operational"
                            }
                        ],
                        "id": "RE5",
                        "Status": "Active",
                        "Target": {
                            "OrgId": {
                                "assigningAuthorityName": "HSCIC",
                                "extension": "QE1",
                                "root": "2.16.840.1.113883.2.1.3.2.4.18.48"
                            },
                            "PrimaryRoleId": {
                                "id": "RO261",
                                "uniqueRoleId": 300734
                            }
                        },
                        "uniqueRelId": 666658
                    },
                    {
                        "Date": [
                            {
                                "End": "2020-03-31",
                                "Start": "2016-04-01",
                                "Type": "Operational"
                            }
                        ],
                        "id": "RE5",
                        "Status": "Inactive",
                        "Target": {
                            "OrgId": {
                                "assigningAuthorityName": "HSCIC",
                                "extension": "Q84",
                                "root": "2.16.840.1.113883.2.1.3.2.4.18.48"
                            },
                            "PrimaryRoleId": {
                                "id": "RO210",
                                "uniqueRoleId": 278955
                            }
                        },
                        "uniqueRelId": 464825
                    }
...

Solution

  • enter image description here

    enter image description here

    enter image description here

    enter image description here

    NOTE: Instead of copying the response to a JSON file, use REST linked service to access this open-source API to directly read the data. However the data preview would be slightly different from what you see above.

    enter image description here