Question: I know you do not have the files, I just need code...thank you! Reading and Writing JSON files 1. Add the required import statement for
I know you do not have the files, I just need code...thank you!
Reading and Writing JSON files
1. Add the required import statement for json 2. Open for 'read' the file 'best_selling_books.json' 3. Use the json.load() command to parse the JSON into a variable named bookdata_dict.
4. Use json.dumps() with indent=4 to create a JSON object named json_desserts
NOTE: Use the desserts_dict dictionary definition provided for you below!!!
desserts_dict = {'Cookies': ['Chocolate Chip','Peanut Butter', 'Oatmeal Raisin', 'Macaroons', 'Sugar'], 'Cakes': ['Chocolate', 'Red Velvet', 'Lemon', 'Black Forest', 'Cheesecake'], 'Ice Cream': ['Vanilla', 'Chocolate', 'Strawberry', 'Mint Chocolate Chip', 'Butter Pecan'], 'Pastries': ['Bear Claw', 'Cinnamon Roll', 'Beignets', 'Doughnut', 'Pain Au Chocolat'] }
5. Write a JSON file named desserts.json using Pythons json.dump() command.
NOTE: Use the desserts_dict dictionary created in the precious steps!!!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
