Microsoft SQL Server JSON in Sql Server Format Query Results as JSON with FOR JSON

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Input table data (People table)

IdNameAge
1John23
2Jane31

Query

SELECT Id, Name, Age
FROM People
FOR JSON PATH

Result

[
    {"Id":1,"Name":"John","Age":23},
    {"Id":2,"Name":"Jane","Age":31}
]


Got any Microsoft SQL Server Question?