FOR JSON additional options

In both modes of the FOR JSON clause, you can specify additional options to control the output. The following options are available:

  • Add a root node: This option allows you to add a top-level element to the JSON output.
  • Include null values: This option allows you to include null values in the JSON output (by default they are not shown).
  • Remove array wrapper: By using this option, you can format JSON output as a single object.

Get SQL Server 2017 Developer's Guide 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.