SQL server 2016 supports json data
parsing using OPENJSON
. You can use OPENJSON
to map json data
to rows and columns.
BelowYour json Data
[
{ "id" : 2,"name": "John"},
{ "id" : 5,"name": "John"}
]
Here is a simple examplehow you can handle json in sql
//@pJson is json data passed from code.
INSERT INTO YourTable (id, Name)
SELECT id, name
FROM OPENJSON(@pJson)
WITH (id int,
Namename nvarchar(max))
Here is a detailed article which covers this topic.