0

I'm using npm mssql lib with NodeJS to execute a query from SQL Server with the following query

select name, surname, id from clients

the query result is correct, (in SQL Server management studio), but the structure of the JSON object returned to the server is mixed like so:

{
  surname :"foo",
  id:"bar",
  name:"foo bar"
}

How can I tell the SQL Server or the mssql to keep the order of the returned JSON identical to the select clause in the query?

Netanel Stern
  • 149
  • 3
  • 16
  • Not familiar with json, but I don't think this is something you can modify in the SQL query. It's got to be something in the JS. – Tab Alleman Jul 05 '17 at 14:35
  • "An object is an unordered set of name/value pairs" - https://stackoverflow.com/a/4920304/4774345 – dan Jul 05 '17 at 14:38

0 Answers0