FOR JSON Statement

You can execute an SQL query against your database and return the results as a JSON document by using the FOR JSON clause in a SELECT statement.

JavaScript Object Notation (JSON) is a language-independent, text-based data interchange format developed for the serialization of JavaScript data. JSON also represents two structured types: objects and arrays. For more details about JSON format, see http://www.json.org

Quick Links:

Go to Parameters

Go to Examples

Go to Usage

Go to Permissions

Syntax

...For JSON mode

mode
   RAW | AUTO | EXPLICIT

Parameters

(back to top)

Examples

(back to top)

Usage

(back to top)

The FOR JSON clause can be used in any SELECT statement, including subqueries, queries with a GROUP BY clause or aggregate functions, and view definitions. Using the FOR JSON clause represents relational data as a JSON array composed of arrays, objects, and scalar elements.

The format for the alias directive is:

[encapsulating_object!tag!name!qualifier]

where:

Permissions

(back to top)

None