SQL Server OPENJSON read nested json

前端 未结 3 1802
生来不讨喜
生来不讨喜 2020-12-02 08:21

I have some json that I would like to parse in SQL Server 2016. There is a hierarchy structure of Projects->Structures->Properties. I would like to write a query that pars

3条回答
  •  时光取名叫无心
    2020-12-02 09:00

    Typical! I found the answer just after posting the question. You need to use the 'as json' key word when specifying the columns to return:

    select IdProject, Name, structures
    from   openjson (@json)
    with
    (
        IdProject uniqueidentifier,
        Name nvarchar(100),
        structures nvarchar(max) as json
    ) as Projects
    

提交回复
热议问题