how to insert json into table code example
Example 1: insert json into sql
SELECT *
FROM OPENJSON(@json)
WITH (id int 'strict $.id',
firstName nvarchar(50) 'strict $.info.name',
lastName nvarchar(50) '$.info.surname',
age int,
dateOfBirth datetime2)
Example 2: sql server import json
{
"ok": true,
"data": {
"assets": {
"parcels": [{
"id": "51,100",
"x": 51,
"y": 100,
"auction_price": 4444,
"district_id": "77909d00",
"owner": "Dr Cornwallis",
"data": { "version": 0 }
},
//...+ 2499 more objects in the parcels array
],
total: 2500
},
},
}