I am trying to load a JSON file into a PostgreSQL table that I've created, but I can't seem to figure out how to do it.
Everytime I try something it seems to be appropriate with SQL tables but not PostgreSQL.
This is my table :
create table test_opening_hours(
id serial primary key,
info json
);
All I can do is insert lines into the table manually, but my file has 200+ different values so I can't do it this way. I'm pretty sure there must be a way to do it but I can't find how...
here's what I've tried so far :
COPY test_opening_hours(info)
FROM 'data.json' ;
or
declare @jsondata nvarchar(max)
set @jsondata = 'data.json'
insert into test_opening_hours (info)
select * from openjson (@jsondata)