SQL to JSON - Grouping Results into JSON Array
问题 I am trying to come up with an SQL solution for arranging output to match an expected JSON format. I have some simple SQL to highlight where the issue is coming from; SELECT TOP 1 'Surname' AS 'name.family' ,'Forename, Middle Name' AS 'name.given' ,'Title' AS 'name.prefix' ,getDATE() AS 'birthdate' ,'F' AS 'gender' ,'Yes' AS 'active' ,'work' AS 'telecom.use' ,'phone' AS 'telecom.system' ,'12344556' AS 'telecom.value' FROM tblCustomer FOR json path Which will return JSON as; [ { "name": {