OPENJSON function parse JSON text and returns all key:value pairs at the first level of JSON:
declare @json NVARCHAR(4000) = N'{"Name":"Joe","age":27,"skills":["C#","SQL"]}';
SELECT * FROM OPENJSON(@json);
key | value | type |
---|---|---|
Name | Joe | 1 |
age | 27 | 2 |
skills | ["C#","SQL"] | 4 |
Column type describe the type of value, i.e. null(0), string(1), number(2), boolean(3), array(4), and object(5).