prepare data format
- convert data to one line
tr -d '\n' filename
orperl -p -e 's/\n//' filename
orvim filename; :%j ; :wq
- convert escape character
sed -i 's/\\/\\\\/g' filename
- delete tab or space
sed -i 's/ //g;s/\t//g' filename
orperl -p -e 's/ //g;s/\t//g'
create temp table and copy data to temp table
create temp table temp_data(v text);
copy temp_data from 'filepath';
copy data from temp table insert real table
insert into <realtable> select u->>'city_code', u->>'domain', u->>'id' from (select json_array_elements((v::json->>'data')::json) as u from temp_data) t