I'm going a bit mad with this one, and I'm sure it'll be something easily spotted by someone not staring at it for the last hour...

I have the following JSON (there are more examples of 'Details' but two should suffice for this question:

```
[
    {
        "MonthDetails": [
            {
                "Month": 1,
                "MonthName": "January 2020",
                "Details": [
                    {
                        "ServiceUserName": "Resident 1",
                        "ServiceUserLastName": "Resident",
                        "SUID": "b5259252-2018-43ee-a7a9-842fa7c80473",
                        "InfectionType": "Urinary tract",
                        "DateStarted": "2019-11-05T13:53:01.9392086+00:00",
                        "DateCleared": "Open",
                        "NextReviewDate": "2019-11-06T13:53:01.9392086+00:00",
                        "AntibioticsStartDate": "2019-11-05T00:00:00+00:00",
                        "AntibioticsEndDate": "2019-11-07T00:00:00+00:00",
                        "AcquiredOnAdmission": false,
                        "NeedsBarrierNursing": false,
                        "IsOpen": true,
                        "DaysToClear": 0,
                        "SURecordOpen": true
                    },
                    {
                        "ServiceUserName": "Resident 2",
                        "ServiceUserLastName": "Resident",
                        "SUID": "376cffba-52ce-4de0-855d-dd9e24f466e0",
                        "InfectionType": "Chest",
                        "DateStarted": "2019-12-04T12:11:30.7777465+00:00",
                        "DateCleared": "Open",
                        "NextReviewDate": "2019-12-05T12:11:30.7777465+00:00",
                        "AntibioticsStartDate": "2019-12-01T00:00:00+00:00",
                        "AntibioticsEndDate": "2019-12-08T00:00:00+00:00",
                        "AcquiredOnAdmission": true,
                        "NeedsBarrierNursing": false,
                        "IsOpen": true,
                        "DaysToClear": 0,
                        "SURecordOpen": true
                    }
                ],
                "criteria": null,
                "Errors": {},
                "DateFrom": "0001-01-01T00:00:00",
                "SelectedDateRange": null,
                "NumberOfDays": 0
            }
        ]
    }
]

```

My understanding was that if I wanted to get eg. MonthDetails.Details >> ServiceUserName, SUID, etc, I could use the following code:

```
SELECT * INTO Residents FROM OPENJSON(@JSON, '$.MonthDetails.Details') 
    WITH
    (   
        ServiceUserName nvarchar(100) '$.ServiceUserName',
        ServiceUserLastName nvarchar(100) '$.ServiceUserName',
        SUID nvarchar(150) '$.SUID',
        InfectionType nvarchar(30) '$.InfectionType',
        DateStarted nvarchar(10) '$.DateStarted',
        DateCleared nvarchar(10) '$.DateCleared',
        NextReviewDate nvarchar(10) '$.NextReviewDate',
        AntibioticsStartDate nvarchar(10) '$.AntibioticsStartDate',
        AntibioticsEndDate nvarchar(10) '$.AntibioticsEndDate',
        AcquiredOnAdmission nvarchar(5) '$.AcquiredOnAdmission',
        NeedsBarrierNursing nvarchar(5) '$.NeedsBarrierNursing',
        IsOpen nvarchar(5) '$.IsOpen',
        DaysToClear nvarchar(5) '$.DaysToClear',
        SURecordOpen nvarchar(5) '$.SURecordOpen'
    )

```

However, all that happens is that one record is creating one entry with NULL in every column. I'm aware that I can just do $.MonthDetails and then pass the Details as JSON through and cross apply it, but I thought the preferred method above should work too?

Thanks
Ant