Using Python to insert JSON into PostgreSQL
There's no need to have python parse the json; just pass through the file contents, retrieved with .read(), to cursor.execute() as a parameter (&amp; make sure to wrap in in a tuple, as shown below). And don't forget connection.commit() or you'll never actually see the inserted data as it'll be rolled back when the connection closes after python finishes running.

import psycopg2
connection = psycopg2.connect(connection_string)
cursor = connection.cursor()
cursor.execute("set search_path to public")


with open('data.json') as file:
    # change json.load(file) to file.read()
    data = file.read()

# Just put a placeholder %s instead of using {} and .format().
query_sql = """
insert into json_table select * from
json_populate_recordset(NULL::json_table, %s);
"""

# change .execute(query_sql) to .execute(query_sql, (data,))
cursor.execute(query_sql, (data,))
# Add a commit on the connection.
connection.commit()