I'm working on a json file in python like this:
[{
"_id": {
"$oid": "60de048cd7905488bbe0e511"
},
"item_name": "STOCKHOLM",
"item_type": "Sofa",
"item_id": "302.450.44",
"item_detail": [
"3paxsofa",
"seglora"
],
"item_price": "18990",
"item_count": "35",
"item_size": {
"width:": "211 cm",
"depth:": "88 cm",
"height:": "80 cm",
"heigth2:": "14 cm",
"height3:": "72 cm",
"depth2:": "158 cm",
"depth3:": "59 cm",
"height4:": "43 cm",
"no:": "3 "
},
"item_collapsepk": {
"product_id: ": "302.450.44",
"pack: ": "1",
"depth: ": "216 cm",
"width: ": "92 cm",
"height: ": "60 cm",
"total_weight: ": "71.26 kg",
"net_weight: ": "56.64 kg",
"pack_per: ": "1176.0 L"
},
"maintenance": [
"avoid sunset ",
"clear with wet towel"
],
"item_good": [
"natural leather ",
"softer leathwe ",
"depper color and longer lifespan",
"Niels Gammelgaard"
],
"item_env": {}
},{
"_id": {
"$oid": "60de048fd7905488bbe0e513"
},
"item_name": "HEMLINGBY",
"item_type": "sofa",
"item_id": "704.343.68",
"item_detail": [
"2pax sofa",
"knisa"
],
"item_price": "899",
"item_count": "2627",
"item_size": {
"width:": "145 cm",
"depth:": "71.5 cm",
"height:": "71.5 cm",
"heigth2:": "14.5 cm",
"height3:": "61 cm",
"depth2:": "137 cm",
"depth3:": "54 cm",
"height4:": "42 cm"
},
"item_collapsepk": {
"product_id: ": "704.343.68",
"pack: ": "1",
"depth: ": "137 cm",
"width: ": "73 cm",
"height: ": "32 cm",
"total_weight: ": "34.32 kg",
"net_weight: ": "29.86 kg",
"pack_per: ": "320.0 L"
},
"maintenance": [
"no bleach",
"no dry"
],
"item_good": [
"fixed"
],
"item_env": {}
},{
"_id": {
"$oid": "60de15b556f3d120e64db051"
},
"item_name": "ANGERSBY",
"item_type": "梳化",
"item_id": "804.571.18",
"item_detail": [
"2paxsofa",
"knisa "
],
"item_price": "1690",
"item_count": "842",
"item_size": {
"width:": "137 cm",
"depth:": "84 cm",
"width1:": "120 cm",
"depth2:": "49 cm",
"heigth2:": "46 cm"
},
"item_collapsepk": {
"product_id: ": "804.571.18",
"pack: ": "1",
"depth: ": "87 cm",
"width: ": "62 cm",
"height: ": "47 cm",
"total_weight: ": "28.00 kg",
"net_weight: ": "26.28 kg",
"pack_per: ": "253.5 L"
},
"maintenance": [
"no bleach",
"no dry",
"咕套",
"fixed",
"40 degree with noral mode"
],
"item_good": null,
"item_env": [
"loner lifespan",
"60%polyester",
"40%rubber"
]
}
]
And I want change all the list in the json file to a dictionary for further usage like this, especially for(item_detail,maintance,item_good,item_env):
[{
"_id": {
"$oid": "60de048cd7905488bbe0e511"
},
"item_name": "STOCKHOLM",
"item_type": "Sofa",
"item_id": "302.450.44",
"item_detail": {
"3paxsofa",
"seglora"
},
"item_price": "18990",
"item_count": "35",
"item_size": {
"width:": "211 cm",
"depth:": "88 cm",
"height:": "80 cm",
"heigth2:": "14 cm",
"height3:": "72 cm",
"depth2:": "158 cm",
"depth3:": "59 cm",
"height4:": "43 cm",
"no:": "3 "
},
"item_collapsepk": {
"product_id: ": "302.450.44",
"pack: ": "1",
"depth: ": "216 cm",
"width: ": "92 cm",
"height: ": "60 cm",
"total_weight: ": "71.26 kg",
"net_weight: ": "56.64 kg",
"pack_per: ": "1176.0 L"
},
"maintenance": {
"avoid sunset ",
"clear with wet towel"
},
"item_good": {
"natural leather ",
"softer leathwe ",
"depper color and longer lifespan",
"Niels Gammelgaard"
},
"item_env": {}
},{
"_id": {
"$oid": "60de048fd7905488bbe0e513"
},
"item_name": "HEMLINGBY",
"item_type": "sofa",
"item_id": "704.343.68",
"item_detail": {
"2pax sofa",
"knisa"
},
"item_price": "899",
"item_count": "2627",
"item_size": {
"width:": "145 cm",
"depth:": "71.5 cm",
"height:": "71.5 cm",
"heigth2:": "14.5 cm",
"height3:": "61 cm",
"depth2:": "137 cm",
"depth3:": "54 cm",
"height4:": "42 cm"
},
"item_collapsepk": {
"product_id: ": "704.343.68",
"pack: ": "1",
"depth: ": "137 cm",
"width: ": "73 cm",
"height: ": "32 cm",
"total_weight: ": "34.32 kg",
"net_weight: ": "29.86 kg",
"pack_per: ": "320.0 L"
},
"maintenance": {
"no bleach",
"no dry"
},
"item_good": {
"fixed"
},
"item_env": {}
},{
"_id": {
"$oid": "60de15b556f3d120e64db051"
},
"item_name": "ANGERSBY",
"item_type": "梳化",
"item_id": "804.571.18",
"item_detail": {
"2paxsofa",
"knisa "
},
"item_price": "1690",
"item_count": "842",
"item_size": {
"width:": "137 cm",
"depth:": "84 cm",
"width1:": "120 cm",
"depth2:": "49 cm",
"heigth2:": "46 cm"
},
"item_collapsepk": {
"product_id: ": "804.571.18",
"pack: ": "1",
"depth: ": "87 cm",
"width: ": "62 cm",
"height: ": "47 cm",
"total_weight: ": "28.00 kg",
"net_weight: ": "26.28 kg",
"pack_per: ": "253.5 L"
},
"maintenance": {
"no bleach",
"no dry",
"咕套",
"fixed",
"40 degree with noral mode"
},
"item_good": null,
"item_env": {
"loner lifespan",
"60%polyester",
"40%rubber"
}
}
]
and the naming can be item_detail1, item_detail2, maintance1, maintance2 etc. I try change the data structure in the python but I fail to get my expected result. How can get this result?
"maintenance": {"no bleach","no dry"}. Dictionaries have keys and values.