diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs
index cddb4f6e..d9c5ae88 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultSet.cs
@@ -8,6 +8,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
+using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts;
@@ -362,6 +363,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
}
// Check if resultset is 'for xml/json'. If it is, set isJson/isXml value in column metadata
SingleColumnXmlJsonResultSet();
+ CheckForIsJson();
}
finally
{
@@ -589,6 +591,28 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
}
}
+ ///
+ /// Check columns for json type and set isJson if needed
+ ///
+ private void CheckForIsJson()
+ {
+ if (Columns?.Length > 0 && RowCount != 0)
+ {
+ Regex regex = new Regex(@"({.*?})");
+ var row = GetRow(0);
+ for (int i = 0; i < Columns.Length; i++)
+ {
+ if (Columns[i].DataTypeName.Equals("nvarchar"))
+ {
+ if (regex.IsMatch(row[i].DisplayValue))
+ {
+ Columns[i].IsJson = true;
+ }
+ }
+ }
+ }
+ }
+
///
/// Determine the special action, if any, for this result set
///