Microsoft SQL Server Filter-out bad JSON text from query results


Example

If some JSON text might not be properly formatted, you can remove those entries from query using ISJSON function.

select ProductID, Name, Color, Size, Price, JSON_VALUE(Data, '$.Type') as Type
from Product
where JSON_VALUE(Data, '$.Type') = 'part'
and ISJSON(Data) > 0