skip to Main Content

How to Join 2 table with json key in Postgres? – Postgresql

I have 2 table CREATE TABLE json_data_table(d_id int, d1_json json, d2_json json); CREATE TABLE user_data(uid int, username varchar); and data respectively are INSERT INTO user_data VALUES (1,'test_user_1'), (2,'test_user_2'), (3,'test_user_3'); INSERT INTO json_data_table VALUES (1,'{"stage1":1,"stage2":2 }', '{ "stage1": { "date": "12-01-2023",…

VIEW QUESTION

Python format json for saving to file

My data looks like this: Key1: [Key2:[{},{},...{}]] The code something like this: dict_={} dict_['Key2']=all_items dict_fin={} dict_fin['Ke1']=[dict_] df=pd.DataFrame(dict_fin) df.to_json(filepath, orient="records",lines=True) I would like to have saved json like this: { "Key1": [{"Key2" : [{},{},...,{}]}] } Instead, I get it like this:…

VIEW QUESTION
Back To Top
Search