SQL Server Convert XML to JSON
<p>I would like to convert an XML column into a JSON string. So far I've tried few options on SO and Google, but all of them convert a table into a JSON string. Is there any way I can do this without converting the xml into a table first? </p>

<p>Version: SQL Server 2014 (SP2)</p>

<pre><code>declare @xml xml
select @xml = xml_column from mytable
select some_potential_function(@xml) as JSON_String
</code></pre>

<p>PS: My xml grows dynamically as I store a tree with varying number of levels in it. That's why converting it to a table may not be an option. </p>