Build your own JSON structure


Please note: Check out how you return simple or multiple tables before you consider of using this.

Basics

Set the ResponseDataMode to 'json' to use this feature.
@ResponseDataMode='json'
Requirements: The first table has to include the field "Json".
SELECT '{"Data"="Hello World"}' as Json

Adding more information, using different tables

If you want to add more information, you have to create a reference in the same table. 0 as Template is a reference to the first table. The names are optional. You can give the tables your own names.
SELECT '{"Data"="Hello {$People.Name$}"}' as Json, 1 as People

SELECT 'John Doe' as Name
The output will be:
{"Data"="Hello John Doe"}

Adding more information, using repeater and multiple tables

SELECT '{"Data"="<sql repeat="s in Stats" seperator=",">{$s.Value$}</sql>"}' as Json, 1 as Stats

SELECT top 10 Value FROM Stats
The output will be:
{"Data"="1,2,3,4,5,6,7,8,9,10"}
Last updated: 26 Nov 2015

Give us feedback

AngularJS <-> Microsoft SQL

Exchange data between your AngularJS application and your Microsoft SQL Server