OPENJSON with the default schema

When you don't specify a schema for returned results, the OPENJSON function returns a table with three columns:

  • Key: This is the name of a JSON property or the index of a JSON element. The data type of the column is nvarchar, the length is 4,000, collation is Latin1_General_BIN2, and the column does not allow null values.
  • Value: This is the value of the property or index defined by the key column. The data type of the column is nvarchar(max), it inherits collation from the input JSON text, and nulls are allowed.
  • Type: The JSON data type of the value. The data type of the column is tinyint. Following table lists the possible values for this column and appropriate descriptions:

OPENJSON mapping of JSON data ...

Get Mastering SQL Server 2017 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.