Skip to content
Advertisement

SQL OpenJson – Cannot create a column for json inside of json

I’ve been playing around with OPENJSON in sql and have a question.

Say I have the following JSON,

I am able to use OPENJSON to create columns on the fly for all apart from source.

Here is my code:

I am getting every column back apart from the nested json data.

Feel free to edit the question title

Advertisement

Answer

Not quite sure why your source starts with ‘$’. if you want to get data from nested json, you need to identity the roots for the column. for example

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement