Hi @Vuyiswa Maseko
Agree with YitzhakKhabinsky, your Json is not well formatted, since it doesn't have comma(,) at the end of each Json data. And you need to add '[' and ']' at both the start and end position.
Try this:
DECLARE @JSON NVARCHAR(MAX)
SELECT @JSON='[' + STUFF(REPLACE(BulkColumn,'{"id":',',{"id":'),1,1,'')+ ']'
FROM OPENROWSET (BULK 'G:\hacki\gz\part-00000\part-1', SINGLE_CLOB) j;
SELECT book.*
FROM OPENJSON (@JSON)
WITH (id varchar(max) ,
full_name varchar(max) ,
middle_name varchar(max) ,
last_name varchar(max) ,
gender varchar(max) ,
birth_year varchar(max) ,
birth_date varchar(max) ,
linkedin_url varchar(max) ) as book
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.