Azure Data Studio- Export Any SQL SERVER Query As JSON

In the industry, I see that Azure Data Studio (ADS) is getting adopted along with SQL Server Management Studio (SSMS). I will still say that ADS is not the replacement of SSMS and for the near future it seems that they will co-exist. Recently, one of my clients’ Comprehensive Database Performance Health Check asked me if I know a way to export any query as JSON with SSMS without writing code.

Honestly, it is not possible to generate from the query output to JSON without writing code in SQL Server Management Studio but it is possible to do that in the Azure Data Studio.

Azure Data Studio- Export Any SQL SERVER Query As JSON queryJSON-800x656

Azure Data Studio – Query as JSON

If you are new to Azure Data Studio, here are the blog posts which you can refer to

Now let us see how quickly we can generate JSON from Azure Data Studio.

First, create a connection to the database by clicking on the new connection in ADS. Next, open the new query window and type the following query for the sample database WideWorldImporters.

SELECT TOP 100 *
FROM WideWorldImporters.Sales.Invoices

Now run the query and it will bring the following output in the ADS.

Azure Data Studio- Export Any SQL SERVER Query As JSON ads1

If you look at the very right side of the ADS there are five different icons listed there. The third icon is the one that is important for our task to convert the query results to JSON. Click on it and it will immediately open a new window with the output in the JSON for the query result.

Azure Data Studio- Export Any SQL SERVER Query As JSON ads2

Additionally, you can also easily navigate in your JSON document based on the top dropdown.

Azure Data Studio- Export Any SQL SERVER Query As JSON ads3

As JSON numbers start with the zero. When you select the document 2 and it will select the third record (document) in your JSON collection.

I recently worked with MongoDB for a client and worked with JSON documents. I really fell like how JSON works and it indeed is helpful to learn about MongoDB and JSON.

Here are some of the relevant blog posts on MongoDB.

Reference: Pinal Dave (https://blog.sqlauthority.com)

ADS Notebook, Azure Data Studio, JSON, SQL Server Management Studio, SSMS
Previous Post
Why SQL Server Doesn’t Give the Memory Back to OS?
Next Post
Azure Data Studio – Explain SQL Server Execution Plan

Related Posts

1 Comment. Leave new

  • Converted by accident, not I want to get it back to normal.

    Reply

Leave a Reply