Arshad Mehmood

Search the blog

    Return results in json

    sql1 min read

    The following works for MS SQL Server:

    SELECT *
    FROM Table
    where id = 1
    FOR JSON AUTO, Without_Array_Wrapper;

    Result:

    {"id":1,"name":"test"}