Skip to content
Advertisement

How to get in json a column that combine from two field in sql?

I have table with those columns in mssql:

How to combine name and surname into info when I get json from the sql:

What I get is:

And what I need is:

This is possible to do with mssql? if so, how can I do it in sql?

Advertisement

Answer

You need to use FOR JSON PATH to build the nested ouptut:

Result:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement