JSON Data in T-SQL - SQL Server

Overview

This article gives sample SQL for querying and parsing JSON data in SQL Server

Sample Data

The Before field looks like this

[{
    "Id": 392571,
    "CreatedOn": "2019-06-19T03: 00: 28"
}]

Sample Code

select top 10
     Id
    ,a.[Before]
    ,IdBefore       = json_value(a.[Before], '$[0]."Id"')
from 
    dbo.AuditLog a