Understanding JSON

JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write, and easy for machines to parse and generate. It is commonly used for transmitting data in web applications, APIs, and configuration files.
Originally derived from JavaScript, JSON has become a language-independent format that is widely supported across programming languages. It represents data as key-value pairs, arrays, and nested structures, making it versatile for various applications.
import requests
import pandas as pd
import numpy as npFetching JSON Data from a URL¶
We will fetch a JSON file from GitHub and parse it to extract information about makeup foundation products.
url = "https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/search-results/foundation-page-01.json"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
print("Foudnation products search results successfully loaded!")
else:
raise Exception(f"Failed to fetch data: {response.status_code}")Foudnation products search results successfully loaded!
response.json() method parses the JSON content of the response and returns it as a Python dictionary (or list, depending on the structure of the JSON). This allows us to easily access and manipulate the data in Python.
type(data)dictGeneral Workflow in Working with JSON Data¶
You may be working with JSON data that has a strict schema, or you may be working with data that has a more flexible structure. How you approach parsing the data will depend on the structure of the JSON and your specific goals. Here is a general workflow for working with JSON data:
In our case, we don’t have a strict schema for the makeup foundation products, so we will be working with a more flexible structure. We will parse the JSON into a generic dictionary and inspect the keys and value types at runtime to understand the structure of the data. This will allow us to extract the information we need while being cautious about potential issues such as missing keys or unexpected data types.
# Inspect the top-level keys
print("Top-level keys:")
print(data.keys())Top-level keys:
dict_keys(['requestMetadata', 'productResults', 'pagination'])
first_product = data["productResults"][0]
first_product{'position': 1,
'asin': 'B01H1V7WQU',
'title': 'LAURA GELLER NEW YORK Award-Winning Baked Balance-n-Brighten Color Correcting Powder Foundation - Light - Buildable Light to Medium Coverage - Demi-Matte Natural Finish',
'isSponsored': False,
'price': {'symbol': '$', 'currentPrice': 19, 'beforePrice': 38},
'specification': ['0.32 Ounce (Pack of 1)'],
'image': 'https://m.media-amazon.com/images/I/71zh8GABKAL.jpg',
'reviews': {'totalReviews': 67800, 'rating': 4.2},
'badges': {'amazonPrime': False,
'amazonChoice': False,
'amazonExclusive': False,
'bestSeller': False},
'boughtInPastMonth': '20K+',
'deliveryInfo': {'freeDelivery': 'Sun, Apr 5',
'fastestDelivery': 'Tomorrow, Apr 1'},
'url': 'https://www.amazon.com/dp/B01H1V7WQU'}Extract Search Results Information from JSON Data¶
JSON mimics the structure of Python dictionaries and lists, so we can use familiar syntax to access the data. Each product in the dataset is represented as a dictionary with keys such as “asin”, “title”, and “price”. We can iterate through the list of products and extract these details to analyze the makeup foundation products.
As a first exercise, try extracting the ASIN (Amazon Standard Identification Number) and the product title of each product from the JSON data. This will help you get comfortable with navigating the structure of the JSON and accessing specific pieces of information.
First, check the data type of data["productResults"] to confirm that it is a list.
type(data["productResults"])listEach item in the list is a dictionary representing a product.
type(data["productResults"][0])dictCheck the keys of the first product to see what information is available.
data["productResults"][0].keys()dict_keys(['position', 'asin', 'title', 'isSponsored', 'price', 'specification', 'image', 'reviews', 'badges', 'boughtInPastMonth', 'deliveryInfo', 'url'])for product in data["productResults"]:
print(f"ASIN: {product['asin']}, Title: {product['title']}")ASIN: B01H1V7WQU, Title: LAURA GELLER NEW YORK Award-Winning Baked Balance-n-Brighten Color Correcting Powder Foundation - Light - Buildable Light to Medium Coverage - Demi-Matte Natural Finish
ASIN: B008C13146, Title: Maybelline Dream Fresh Skin Hydrating BB cream, 8-in-1 Skin Perfecting Beauty Balm with Broad Spectrum SPF 30, Sheer Tint Coverage, Oil-Free, Light/Medium, 1 Fl Oz
ASIN: B0BD4MMFVM, Title: GAOY 16ml 2 Pcs Glassy Gel Top Coat and Base Coat Set,No Wipe Foundation Combination for UV Light Cure Nail Polish
ASIN: B0G1T61T7X, Title: Prime Prometics Color Changing Foundation for Mature Women – Instantly Adapts to Your Skin Tone – Buildable Light-to-Medium Coverage – 12-Hour Wear – Natural Dewy Finish – Hypoallergenic
ASIN: B0G1VBDXYF, Title: Luxe Color Changing Foundation for Women – Instantly Adapts to Your Skin Tone – Buildable Light-to-Medium Coverage – 12-Hour Wear – Natural Dewy Finish - Medium
ASIN: B0DJ8Z98MY, Title: Blanc Cover Cream Stick V White - Korean Color-Changing Foundation Stick with Volufiline - Medium to Full Coverage Dewy Finish Base Makeup - Dual-Ended with Detachable Brush (202 Natural)
ASIN: B01ACPW2QC, Title: COVERGIRL & Olay Simply Ageless 3-in-1 Liquid Foundation, Matte Finish, Hyaluronic & Vitamin C Formula, 220 Creamy Natural, 1 Count
ASIN: B07CF7BVZK, Title: Westmore Beauty Body Coverage Perfector – Waterproof Leg & Body Makeup/Bronzer For Women - Best Tattoo Cover Up Makeup & Tattoo Concealer - 3.5 Oz Natural Radiance
ASIN: B00JZ4V6V4, Title: e.l.f. Poreless Face Primer, Skin-Smoothing Matte Makeup Base, Minimizes Pores & Fine Lines, Long-Lasting Foundation Primer with Tea Tree & Vitamins A & E, Vegan & Cruelty-Free
ASIN: B00L2SNFPQ, Title: L'Oréal Paris Makeup Magic Skin Beautifier BB Cream Tinted Moisturizer, Anti-Redness, 1 fl oz, 1 Count
ASIN: B0080G8Q2U, Title: bareMinerals Original Loose Powder Foundation SPF 15, Clean Mineral Powder Face Makeup, Sheer-to-Full Coverage, Talc-Free, Non-Comedogenic, Vegan, Cruelty-Free & Dermatologist-Tested
ASIN: B0BCGZMTSY, Title: L'Oreal Paris True Match Super-Blendable Foundation, Medium Coverage Liquid Foundation Makeup, N3, Light Medium, 1 Fl Oz
ASIN: B01BRD1TPI, Title: LAURA GELLER NEW YORK Baked Double Take Powder Foundation - Fair - Buildable Medium to Full Coverage - Matte Finish
ASIN: B0DPQJRX8N, Title: Foundation 4 in 1 - Color Changing Foundation, Medium Spectrum with SPF 50, Hypoallergenic Hydrating Liquid Concealer, Long-lasting & Waterproof Natural Finish - 1.06 fl oz
ASIN: B0B6Q7DZ8P, Title: Jerome Alexander MagicMinerals AirBrush Foundation – 2 Piece Set with Airbrush Foundation and Kabuki Brush - Spray Makeup with Anti-aging Ingredients for Smooth Radiant Skin - Light Medium
ASIN: B01LMMZY6O, Title: IT Cosmetics CC+ Cream - Natural Full Coverage Foundation With SPF 50+, Color Corrector & Anti-Aging Hydrating Serum, Hyaluronic Acid + Peptides, Lightweight Up To 24H Wear, All Skin Types
ASIN: B0DCHM66GS, Title: Jerome Alexander My Color Self-Adjusting Foundation, Hydrating & Lightweight Face Makeup, Skincare-Infused, with Kabuki Brush, Medium, 1 oz
ASIN: B0FY3Z6S7F, Title: LUMINESS Liquid Mirage w/SPF 50 Color Adjusting Foundation Kit - Color Changing Foundation, SPF 50 Primer & Makeup Brush, Face Makeup for Mature Skin, 4in1 Liquid Foundation, Concealer & Moisturizer
ASIN: B091D8BXSQ, Title: L'Oreal Paris True Match Nude Hyaluronic Tinted Serum Foundation with 1% Hyaluronic acid, Light 2-3, 1 fl. oz.
ASIN: B007A2Z4VQ, Title: PÜR MINERALS 4-in-1 Pressed Mineral Makeup Powder Foundation with SPF 15 - Concealer & Finishing Compact Pressed Powder for Face - Buildable Medium to Full Coverage Foundation Powder
ASIN: B00D2NUU8Y, Title: COVERGIRL & Olay Simply Ageless Instant Wrinkle-Defying Foundation, Creamy Natural 0.44 Fl Oz (Pack of 1)
ASIN: B00I50QVAU, Title: Almay Skintone Matching Foundation, Smart Shade Face Makeup with SPF 15, Hypoallergenic, Oil-Free, Dermatologist-Tested, 200 Light Medium Mine, 1 fl oz
ASIN: B0DDTB8LJM, Title: MISSHA M PERFECT COVER SERUM BB CREAM No.23 Natural Beige-Light/Medium with Cool/Neutral Undertone, Skin Tint, Tinted Moisturizer, Skin Care Foundation Makeup, 1.18 Fl oz
ASIN: B01LXJHM36, Title: L.A. Girl HD Pro.Conceal, Peach Corrector GC994
ASIN: B077SS92SG, Title: LAURA GELLER NEW YORK Baked Balance-N-Glow Illuminating Foundation - Medium - Buildable Sheer to Light Coverage - Satin Finish
ASIN: B09LCMQM44, Title: TIRTIR Mask Fit Red Cushion Foundation | Full coverage, Weightless, Skin fit, Satin Glow Finish, Korean Makeup BB Foundation, beauty, Tattoo cover up, Buildable (#21N Ivory, 0.63 Fl Oz)
ASIN: B0D3JFKVX1, Title: e.l.f. Soft Glam Foundation, Medium Coverage, Long-Lasting & Buildable Foundation For A Smooth, Satin Finish, Vegan & Cruelty-Free, 25 Light Neutral
ASIN: B01N5QC1CL, Title: M. Asam Magic Finish Make-Up Mousse (1.01 Fl Oz) – 4in1 Primer, Foundation, Concealer & Powder With Buildable Coverage, Hides Redness And Dark Spots, Vegan, For Light To Medium Skin Tones
ASIN: B0BZQKGZQ3, Title: Maybelline Super Stay Up to 24HR Skin Tint, Radiant Light-to-Medium Coverage Foundation, Makeup Infused With Vitamin C, 120, 1 Count
ASIN: B00PFCSURS, Title: Maybelline Fit Me Matte + Poreless Liquid Oil-Free Foundation Makeup, Natural Beige, 1 Count (Packaging May Vary)
ASIN: B0BB313T4N, Title: ICONIC LONDON Underglow Blurring Primer | Blurs Imperfections and Gives Skin a Radiant Glow, Cruelty-Free, Vegan Makeup Universal Shade, 0.91 Fl oz
ASIN: 0310441870, Title: NIV, Foundation Study Bible, Leathersoft, Brown, Red Letter
ASIN: B07GV322NS, Title: IT Cosmetics CC+ Cream Illumination - Radiant Full Coverage Foundation With SPF 50+, Color Corrector & Hydrating Anti-Aging Serum, Hydrolyzed Collagen + Peptides, Normal to Dry Skin - 1.08 fl oz
ASIN: B0CGCNJV4P, Title: RŌZ Foundation Shampoo For All Hair Types & Textures | Hydrating & Cleansing For Healthy Hair| Vegan, Color-Safe, Free of Silicone, Sulfates, Paraben, SLS | Strengthens & Nourishes 10.1 oz/300 mL
ASIN: B01DPA6JXS, Title: L'Oreal Paris Makeup Infallible Up to 24HR Pro-Glow Foundation, Creamy Natural, 1 fl oz.
ASIN: B07K6H2P7G, Title: Amazon Basics Smart Box Spring Bed Base, 5-Inch Height Mattress Foundation, Tool-Free Easy Assembly, Metal Support, Full, 74" x 53"
ASIN: B0CBS77N87, Title: EMODA 5 Inch Box Spring Queen Size Bed Base, Heavy Duty Metal Queen Mattress Foundation with Fabric Cover, Easy Assembly, Black
ASIN: B002SPVA9K, Title: Clinique Even Better Makeup Liquid Foundation SPF 15 With Vitamin C For Dry + Oily Combination Skin Types | Medium Coverage + Natural Finish | Evens Skin Tone + Reduces Dark Spots
ASIN: B0BCCDHCZ5, Title: Maybelline Super Stay Up to 24HR Hybrid Powder-Foundation, Medium-to-Full Coverage Makeup, Matte Finish, 220, 1 Count
ASIN: B01M8HNHAK, Title: L.A. Girl Pro Coverage Liquid Foundation, White, 0.95 Fl Oz
ASIN: B0868G5TSM, Title: Bio Mimic Foundation Medium Spectrum by Forever Bloom, Protecting from Sun with SPF50, for Gym, Sports, Dancing
ASIN: B07BCC3NN9, Title: e.l.f. Mineral Infused Face Primer, Primer For A Smooth Foundation Base, Fills In Fine Lines & Refines Complexion, Vegan & Cruelty-free, Large
ASIN: B0CGCJTRGQ, Title: RŌZ Foundation Conditioner | For All Hair Types | Soothes, Nourishes | Hydrating Ceramides, Pea Peptides, Avocado Oil, Strengthen, Protect | Vegan, Paraben, SLS, Sulfate-Free | 10.1 oz / 300 mL
ASIN: B001268TE0, Title: L'Oreal Paris True Match Super Blendable Oil Free Powder Foundation, W4 Light Medium, 0.33 oz, Packaging May Vary
ASIN: B0BBFWFN42, Title: Tower 28 SunnyDays SPF 30 Tinted Moisturizer - 2-in-1 Buildable Coverage Foundation + Mineral Sunscreen for Face - Zinc Oxide, Aloe & Prickly Pear for Sensitive Skin - 15/Light Warm (1 oz)
ASIN: B00AOU5NVC, Title: Neutrogena Mineral Sheers Lightweight Loose Powder Makeup Foundation with Vitamins A, C, & E, Sheer to Medium Buildable Coverage, Skin Tone Enhancer, Face Redness Reducer, Nude 40,.19 oz
ASIN: B00757ASD0, Title: CoverGirl Aquasmooth SPF 20 Compact Foundation, 725 Buff Beige, 0.4 Ounce
ASIN: B0DLHD2DVC, Title: Maybelline Super Stay Lumi-Matte Foundation, Lightweight and Buildable Full Coverage Foundation Makeup For Up To 30HR Wear, 120, 1 Count
ASIN: B0169YYCP4, Title: Maybelline Fit Me Matte + Poreless Liquid Oil-Free Foundation Makeup, Cappuccino, 1 Count (Packaging May Vary)
ASIN: B0DJ8Z98MY, Title: Blanc Cover Cream Stick V White - Korean Color-Changing Foundation Stick with Volufiline - Medium to Full Coverage Dewy Finish Base Makeup - Dual-Ended with Detachable Brush (202 Natural)
ASIN: B0C5GTRPFQ, Title: Summer Fridays Sheer Skin Tint - Skin Tint with Hyaluronic Acid - Helps Diminish Uneven Skin Tone - Sheer to Light Coverage - Shade 1 - Fair with Neutral Peach Undertones (1 Fl Oz)
ASIN: B0D3JDKD8D, Title: e.l.f. Soft Glam Foundation, Medium Coverage, Long-Lasting & Buildable Foundation For A Smooth, Satin Finish, Vegan & Cruelty-Free, 50 Deep Warm
# Collect data into a list of dictionaries
rows = []
for product in data["productResults"]:
rows.append({"asin": product.get("asin"), "title": product.get("title")})
df = pd.DataFrame(rows)
df.head()This extracts the products information from the first page. You can repeat this process for other files to extract the products from all five pages. We won’t go through that process here, but you can try it on your own to practice working with JSON data from multiple sources. Here are the URLs of the JSON files for the other pages.
search_result_pages = [
"https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/search-results/foundation-page-01.json",
"https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/search-results/foundation-page-02.json",
"https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/search-results/foundation-page-03.json",
"https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/search-results/foundation-page-04.json",
"https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/search-results/foundation-page-05.json",
]Compiled Result¶
df_products = pd.read_csv(
"https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/products.csv"
)
df_products.head()df_products.info()<class 'pandas.DataFrame'>
RangeIndex: 227 entries, 0 to 226
Data columns (total 2 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 asin 227 non-null str
1 title 227 non-null str
dtypes: str(2)
memory usage: 38.1 KB
Retrieving Detailed Product Information¶
The ASIN and title are just two pieces of information about the products. Each product detail information is separately stored in a different JSON file. To get the detailed information about each product, we need to fetch the corresponding JSON file for each product using its ASIN and extract the relevant details from it. This will allow us to build a more comprehensive dataset of makeup foundation products with all the necessary information for analysis.
The JSON files for the detailed product information are available in this GitHub repository folder. They are structured similarly to the search results, but contain more detailed attributes about each product, such as price, ratings, and other specifications. By fetching and parsing these files, we can enrich our dataset and perform more in-depth analysis on the makeup foundation products.
url = "https://raw.githubusercontent.com/bdi593/datasets/main/amazon-makeup-foundation-products/product-results/B001268TE0.json"
response = requests.get(url)
if response.status_code == 200:
product_data = response.json()
print("Product detailed information successfully loaded!")
else:
raise Exception(f"Failed to fetch data: {response.status_code}")Product detailed information successfully loaded!
product_data{'requestMetadata': {'id': '4fa930d7-8482-4d4d-a5c6-bf1f3e64e503',
'status': 'ok',
'html': 'https://files.hasdata.com/4fa930d7-8482-4d4d-a5c6-bf1f3e64e503.html',
'json': 'https://files.hasdata.com/4fa930d7-8482-4d4d-a5c6-bf1f3e64e503.json',
'url': 'https://www.amazon.com/dp/B001268TE0'},
'product': {'asin': 'B001268TE0',
'url': 'https://www.amazon.com/dp/B001268TE0',
'title': "L'Oreal Paris True Match Super Blendable Oil Free Powder Foundation, W4 Light Medium, 0.33 oz, Packaging May Vary",
'isAvailable': True,
'primaryFeatures': {'size': '0.33 Ounce (Pack of 1)'},
'featureBullets': ['True Match Foundation: Our foundation is a nondrying pressed powder formula that leaves skin with buildable, undetectable coverage and a natural finish. Our foundation makeup shades uniquely match light to dark tones and warm, neutral and cool undertones',
"Super Blendable Coverage: This micro-fine face powder features a lightweight, soft face makeup texture that won't settle into lines, clog pores or cake. Minimizes appearance of pores and improves skin tone evenness and texture after 4 weeks use",
'All Day Color: Our makeup foundation gives you color that stays true all day long and leaves skin comfortable. Use included mirror and make up applicator for easy on-the-go powder foundation application',
"Because You're Worth It: Create the look you want with our full line of makeup including foundations, concealers, highlighter makeup, brow pencils, eyeshadow palettes, lipsticks and much more",
"L'Oreal Paris Beauty: A leading total beauty care company based in Paris, we offer innovative products and unique expertise from beauty experts in makeup, skin care, hair care, styling and hair color"],
'description': "True Match Powder precisely matches your skin's tone and texture and coordinates perfectly with True Match Makeup, Blush, and Concealer. Micro-fine powder provides versatile coverage: you can blot shine, blend for a natural finish, or build for more coverage. True Match Powder's formula contains a hint of pearl pigments that enhance your skin's tone. Wear True Match Powder over True Match Makeup or alone for a flawless look. Precisely matches your skin tone and texture Never looks chalky or cakey Natural Finish Mirror inside Use True Match Powder to blot shine on your T-zone, to blend all over the face for a natural finish, or to build for fuller coverage. By L'Oreal Paris",
'boughtInPastMonth': '2K+',
'badges': {'amazonChoice': True,
'amazonExclusive': False,
'amazonPrime': True,
'bestSeller': False,
'limitedTimeDeal': False},
'breadcrumbs': ['Beauty & Personal Care', 'Makeup', 'Face', 'Powder'],
'variants': [{'asin': 'B0FYKDP946',
'title': 'N7 Medium Deep 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B0FYKDP946',
'imageUrl': 'https://m.media-amazon.com/images/I/71WYPjrHfOL._SL1500_.jpg'},
{'asin': 'B0G2TCW8YY',
'title': 'N1 Light 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B0G2TCW8YY',
'imageUrl': 'https://m.media-amazon.com/images/I/61ENBrSMU-L._SL1500_.jpg'},
{'asin': 'B0CFCX39F1',
'title': 'C12 Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B0CFCX39F1',
'imageUrl': 'https://m.media-amazon.com/images/I/71aAFj0PW7L._SL1500_.jpg'},
{'asin': 'B001KYROCW',
'title': 'W7 Medium Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYROCW',
'imageUrl': 'https://m.media-amazon.com/images/I/71NKb6y5c5L._SL1500_.jpg'},
{'asin': 'B001KYTTKC',
'title': 'C3 Light Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYTTKC',
'imageUrl': 'https://m.media-amazon.com/images/I/71JeW8sw-WL._SL1500_.jpg'},
{'asin': 'B0FYKCLNF7',
'title': 'C6 Medium 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B0FYKCLNF7',
'imageUrl': 'https://m.media-amazon.com/images/I/71TV1EhKmnL._SL1500_.jpg'},
{'asin': 'B0FYKJ7L4G',
'title': 'N4 Light Medium 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B0FYKJ7L4G',
'imageUrl': 'https://m.media-amazon.com/images/I/71pucm4TrJL._SL1500_.jpg'},
{'asin': 'B0CFD2FZ4V',
'title': 'W10 Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B0CFD2FZ4V',
'imageUrl': 'https://m.media-amazon.com/images/I/717nw1+gfJL._SL1500_.jpg'},
{'asin': 'B0084A72RW',
'title': 'Deep Golden 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B0084A72RW',
'imageUrl': 'https://m.media-amazon.com/images/I/61ZAga6jDBL._SL1024_.jpg'},
{'asin': 'B004YMRQX4',
'title': 'Natural Ivory [C2] 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B004YMRQX4',
'imageUrl': 'https://m.media-amazon.com/images/I/616fryGsh5L._SL1500_.jpg'},
{'asin': 'B001KYVMM0',
'title': 'W5 Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYVMM0',
'imageUrl': 'https://m.media-amazon.com/images/I/71JUtHz+ooL._SL1500_.jpg'},
{'asin': 'B000UH1B9W',
'title': 'N5 Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B000UH1B9W',
'imageUrl': 'https://m.media-amazon.com/images/I/71CYzFJbdSL._SL1500_.jpg'},
{'asin': 'B0CFCWFJ4N',
'title': 'C9 Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B0CFCWFJ4N',
'imageUrl': 'https://m.media-amazon.com/images/I/716nX1scNEL._SL1500_.jpg'},
{'asin': 'B000UGZD9M',
'title': 'W3 Light Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B000UGZD9M',
'imageUrl': 'https://m.media-amazon.com/images/I/71ljB4KG9OL._SL1500_.jpg'},
{'asin': 'B0FYKR8162',
'title': 'W2 Light 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B0FYKR8162',
'imageUrl': 'https://m.media-amazon.com/images/I/61gx29xEsNL._SL1500_.jpg'},
{'asin': 'B0FYK8G4J8',
'title': 'W1 Light 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B0FYK8G4J8',
'imageUrl': 'https://m.media-amazon.com/images/I/615aRDpzyXL._SL1500_.jpg'},
{'asin': 'B000UGZDCY',
'title': 'N3 Light Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B000UGZDCY',
'imageUrl': 'https://m.media-amazon.com/images/I/71PlzNwbE+L._SL1500_.jpg'},
{'asin': 'B000UGZDBU',
'title': 'W6 Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B000UGZDBU',
'imageUrl': 'https://m.media-amazon.com/images/I/71XyejuocdL._SL1500_.jpg'},
{'asin': 'B0CFD286T2',
'title': 'N9 Medium Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B0CFD286T2',
'imageUrl': 'https://m.media-amazon.com/images/I/71zXP4V8C+L._SL1500_.jpg'},
{'asin': 'B0FYKJS3VL',
'title': 'W7 Medium Deep 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B0FYKJS3VL',
'imageUrl': 'https://m.media-amazon.com/images/I/71ObopReoJL._SL1500_.jpg'},
{'asin': 'B000UGXFDI',
'title': 'N1 Light 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B000UGXFDI',
'imageUrl': 'https://m.media-amazon.com/images/I/71zbycSTc9L._SL1500_.jpg'},
{'asin': 'B001KYVMES',
'title': 'N7 Medium Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYVMES',
'imageUrl': 'https://m.media-amazon.com/images/I/71gsLKJzY9L._SL1500_.jpg'},
{'asin': 'B000UGZDD8',
'title': 'N4 Light Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B000UGZDD8',
'imageUrl': 'https://m.media-amazon.com/images/I/71-qKCc1Y9L._SL1500_.jpg'},
{'asin': 'B078JJT974',
'title': 'Sand Beige 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B078JJT974',
'imageUrl': 'https://m.media-amazon.com/images/I/815L-ztf-qL._SL1500_.jpg'},
{'asin': 'B004YMRR7E',
'title': 'Creamy Natural C3 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B004YMRR7E',
'imageUrl': 'https://m.media-amazon.com/images/I/617rfAd6UEL._SL1180_.jpg'},
{'asin': 'B001KYVMOI',
'title': 'C6 Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYVMOI',
'imageUrl': 'https://m.media-amazon.com/images/I/71U2Js-j-2L._SL1500_.jpg'},
{'asin': 'B001KYTTL6',
'title': 'N6 Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYTTL6',
'imageUrl': 'https://m.media-amazon.com/images/I/61IeZG-8eJL._SL1500_.jpg'},
{'asin': 'B001KYVMFM',
'title': 'C8 Medium Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYVMFM',
'imageUrl': 'https://m.media-amazon.com/images/I/71b3QfCrK3L._SL1500_.jpg'},
{'asin': 'B001KYQ1SA',
'title': 'N2 Light 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYQ1SA',
'imageUrl': 'https://m.media-amazon.com/images/I/71ZCGf7drzL._SL1500_.jpg'},
{'asin': 'B001268TE0',
'title': 'W4 Light Medium 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001268TE0',
'imageUrl': 'https://m.media-amazon.com/images/I/71nrTOyWguL._SL1500_.jpg'},
{'asin': 'B001707PLE',
'title': 'W2 Light 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001707PLE',
'imageUrl': 'https://m.media-amazon.com/images/I/71bcCJh3lhL._SL1500_.jpg'},
{'asin': 'B001KYTTBQ',
'title': 'C1 Light 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYTTBQ',
'imageUrl': 'https://m.media-amazon.com/images/I/712bXHJQ+uL._SL1500_.jpg'},
{'asin': 'B004YMREY0',
'title': 'Nude Beige Warm 0.33 Ounce (Pack of 2)',
'url': 'https://www.amazon.com/dp/B004YMREY0',
'imageUrl': 'https://m.media-amazon.com/images/I/41EH+2ufTyL.jpg'},
{'asin': 'B001KYTTQ6',
'title': 'C2 Light 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B001KYTTQ6',
'imageUrl': 'https://m.media-amazon.com/images/I/71v6wMgNIqL._SL1500_.jpg'},
{'asin': 'B000UGVVHK',
'title': 'W1 Light 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B000UGVVHK',
'imageUrl': 'https://m.media-amazon.com/images/I/71w58yoMogL._SL1500_.jpg'},
{'asin': 'B0CFCW824K',
'title': 'N11 Deep 0.33 Ounce (Pack of 1)',
'url': 'https://www.amazon.com/dp/B0CFCW824K',
'imageUrl': 'https://m.media-amazon.com/images/I/71NensTCBAL._SL1500_.jpg'}],
'price': {'symbol': '$',
'currentPrice': 8.72,
'beforePrice': 12.99,
'discount': '-33%',
'priceFrom': 8.72,
'otherOfferQuantity': 6},
'condition': 'One-time purchase',
'deliveryRawDate': 'Sunday, April 5',
'deliveryIsoDate': '2026-04-05T00:00:00.000Z',
'deliveryPriceMessage': 'FREE',
'primeMemberDeliveryRawDate': 'Thursday, April 2',
'primeMemberDeliveryIsoDate': '2026-04-02T00:00:00.000Z',
'primeMemberMessage': 'Order within 9 hrs 20 mins',
'primeMemberDeliveryPriceMessage': 'FREE',
'returns': 'FREE 30-day refund/replacement',
'seller': 'Amazon.com',
'shipper': 'Amazon.com',
'totalImages': 7,
'primaryImage': 'https://m.media-amazon.com/images/I/71nrTOyWguL._SL1500_.jpg',
'images': ['https://m.media-amazon.com/images/I/71nrTOyWguL._SL1500_.jpg',
'https://m.media-amazon.com/images/I/81RVKPaci5L._SL1500_.jpg',
'https://m.media-amazon.com/images/I/81YTzli1b8L._SL1500_.jpg',
'https://m.media-amazon.com/images/I/91yZ0-kiYRL._SL1500_.jpg',
'https://m.media-amazon.com/images/I/81AWELMTGIL._SL1500_.jpg',
'https://m.media-amazon.com/images/I/91qB3Q0H68L._SL1500_.jpg',
'https://m.media-amazon.com/images/I/81W9hmUUDML._SL1500_.jpg'],
'totalVideos': 5,
'primaryVideo': 'https://m.media-amazon.com/images/S/al-na-9d5791cf-3faf/2850b0d8-c7f1-473c-be4a-56b8f32a8599.mp4/productVideoOptimized.mp4',
'videos': ['https://m.media-amazon.com/images/S/al-na-9d5791cf-3faf/2850b0d8-c7f1-473c-be4a-56b8f32a8599.mp4/productVideoOptimized.mp4',
'https://m.media-amazon.com/images/S/al-na-9d5791cf-3faf/79836b53-a123-4c8e-b388-fac80f4caacb.mp4/productVideoOptimized.mp4',
'https://m.media-amazon.com/images/S/al-na-9d5791cf-3faf/ec528ffb-8640-4ac1-84e7-41e707e3eaef.mp4/productVideoOptimized.mp4',
'https://m.media-amazon.com/images/S/al-na-9d5791cf-3faf/90dace81-b2f5-4dda-9c02-eb1c393fb6c1.mp4/productVideoOptimized.mp4',
'https://m.media-amazon.com/images/S/al-na-9d5791cf-3faf/91484529-5a32-417f-b871-e2e5b871fb1a.mp4/productVideoOptimized.mp4'],
'specification': [{'key': 'Brand Name', 'value': "L'Oreal Paris"},
{'key': 'Item Form', 'value': 'Powder'},
{'key': 'Color', 'value': 'W4 Light Medium'},
{'key': 'Model Name',
'value': "L'Oreal Paris True Match Super-Blendable Powder"},
{'key': 'Number of Items', 'value': '1'},
{'key': 'Model Number', 'value': 'K1600403'},
{'key': 'Container Type', 'value': 'Jar'},
{'key': 'Country as Labeled', 'value': 'France'},
{'key': 'Package Type Name', 'value': 'Palette'},
{'key': 'Global Trade Identification Number',
'value': '00071249016442, 00885597234119'},
{'key': 'UPC', 'value': '885597234119 071249016442'},
{'key': 'Manufacturer', 'value': "L'Oreal Paris"},
{'key': 'Best Sellers Rank',
'value': '#1,373 in Beauty & Personal Care (See Top 100 in Beauty & Personal Care) #7 in Face Powder'},
{'key': 'ASIN', 'value': 'B001268TE0'},
{'key': 'Finish Types', 'value': 'Matte'},
{'key': 'Skin Type', 'value': 'All'},
{'key': 'Coverage', 'value': 'Full'},
{'key': 'Product Benefits',
'value': 'Blendable, Non-Greasy, Pore Minimizing'},
{'key': 'Skin Tone', 'value': 'Light'},
{'key': 'Additional Features', 'value': 'Lightweight'},
{'key': 'Item Weight', 'value': '0.1 Pounds'},
{'key': 'Item Dimensions', 'value': '2.64 x 2.68 x 0.67 inches'},
{'key': 'Material Type Free', 'value': 'Oil Free'},
{'key': 'Color Family', 'value': 'neutral'},
{'key': 'Material Features', 'value': 'Natural'}],
'reviewsInfo': {'totalReviews': 20636,
'rating': 4.6,
'starRates': {'fiveStars': '78%',
'fourStars': '12%',
'threeStars': '5%',
'twoStars': '2%',
'oneStars': '3%'},
'customersSay': 'Customers find this powder foundation to be of great quality, with good coverage that effectively hides imperfections, and appreciate its huge range of colors that match skin tones well. The product is lightweight, feels comfortable on the skin, and provides a matte finish that keeps skin from looking shiny. They praise its longevity, noting it lasts throughout the day, and consider it good value for money.',
'aspects': [{'aspect': 'Quality', 'count': 465, 'status': 'positive'},
{'aspect': 'Coverage', 'count': 360, 'status': 'positive'},
{'aspect': 'Color', 'count': 322, 'status': 'positive'},
{'aspect': 'Value for money', 'count': 204, 'status': 'positive'},
{'aspect': 'Longevity', 'count': 150, 'status': 'positive'},
{'aspect': 'Lightweight', 'count': 139, 'status': 'positive'},
{'aspect': 'Finish', 'count': 130, 'status': 'positive'},
{'aspect': 'Effectiveness', 'count': 127, 'status': 'positive'}],
'customersImageUrls': ['https://m.media-amazon.com/images/I/81+d9zZfN+L._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/81fJrOO8FiL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/716-W0d2wxL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/71kVMKj5qwL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/71-dFSVQIzL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/71v2E+ULy9L._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/61cHxqu0ayL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/71XmL851r9L._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/81sPyplfmFL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/61T0Cb48IXL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/71Ud+s7PBHL._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews',
'https://m.media-amazon.com/images/I/81ddgtHLR+L._AC_UC308,308_CACC,308,308_QL80_.jpg?aicid=community-reviews'],
'reviews': [{'reviewTitle': 'Excellent Foundation Powder',
'reviewText': "This is a tried and true product that lives up to the quality of L'Oreal Paris and at a great price! This powder goes on easily as light coverage and leaves your skin natural looking. I highly recommend this product and make sure you get your 'true match'!",
'reviewDate': 'Reviewed in the United States on March 27, 2026',
'customer': 'Judy Rosenthal Martinson',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AGY2OLHZTP424AX3LBMPE2J6E7SA',
'customerStarsRating': 5,
'productSpecs': {'color': 'W2 Light', 'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'Blends well, light coverage',
'reviewText': 'Great product, blends well under the eyes and doesn’t show. Lasts a long time. Great product for me who wears very little makeup.',
'reviewDate': 'Reviewed in the United States on March 8, 2026',
'customer': 'Truthsayer',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AHSGVLHCNENHLXSH3KX5JSLDZGSA',
'customerStarsRating': 5,
'productSpecs': {'color': 'N2 Light', 'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'I Found My True Match!',
'reviewText': 'I love this make up! It’s my go to to stay shine free. L’Oreal True Match has many shades available, which is why I love it, during any season! It goes on light and feels great! Find your True Match like I found mine!,',
'reviewDate': 'Reviewed in the United States on February 14, 2026',
'customer': 'M. Davis',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AEPYHTDBFY3LHY2UVYM5AF5S6PLA',
'customerStarsRating': 5,
'productSpecs': {'color': 'W4 Light Medium',
'size': '0.33 Ounce (Pack of 1)'},
'helpfulVotes': '2 people found this helpful'},
{'reviewTitle': 'High Quality Powder for a Reasonable Price',
'reviewText': 'Excellent Face Powder. Always Available Happy to find the shade that I wanted. Price is good and reliable.',
'reviewDate': 'Reviewed in the United States on March 23, 2026',
'customer': 'Jody Benge',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AHYM4QHFTRP44EFLPQ6363VTRJTQ',
'customerStarsRating': 4,
'productSpecs': {'color': 'C2 Light', 'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'my go-to face powder (mature skin)',
'reviewText': "I'm so glad I found the True Match line of L'oreal make up. I use this powder the same way I'd use a powder foundation. It covers nicely without looking cakey and dry. I sometimes apply it with a foundation brush, sometimes I use a soft puff. The C-1 and C-2 shades are perfect for my skin tone, but I think the C-2 has a bit more of a rosy tone and I like that better. The powder doesn't settle into my pores or fine lines. I also use it around my eyes and on my eyelids with no issues. No matter how many other powders/setting powders I try, I keep coming back to the L'oreal True Match powder.",
'reviewDate': 'Reviewed in the United States on January 22, 2026',
'customer': 'Wanda',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AHSTFUYKSBLQEPSZJBODHEJA6DQQ',
'customerStarsRating': 5,
'productSpecs': {'color': 'C2 Light', 'size': '0.33 Ounce (Pack of 1)'},
'helpfulVotes': '7 people found this helpful'},
{'reviewTitle': 'Great product',
'reviewText': 'Great color. I use this daily.',
'reviewDate': 'Reviewed in the United States on February 21, 2026',
'customer': 'HJB',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AEKWAUSP3FOTCJDWMO7J2KEQ3RUQ',
'customerStarsRating': 5,
'productSpecs': {'color': 'C2 Light', 'size': '0.33 Ounce (Pack of 1)'},
'helpfulVotes': 'One person found this helpful'},
{'reviewTitle': 'Soft, Smooth and not shiny',
'reviewText': "Love this powder, leave my face soft, without feeling like I am wearing makeup at all. Blends well with foundation, and doesn't leave your skin shiny like others do. Will definitely buy again.",
'reviewDate': 'Reviewed in the United States on March 2, 2026',
'customer': 'NBY',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AGGNH4NZTPUSXGMXXSJGBPU3DW2Q',
'customerStarsRating': 5,
'productSpecs': {'color': 'W3 Light Medium',
'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'Exelente ❤️❤️',
'reviewText': "I've always used it and its finish is the best a single pass and covers my face",
'reviewDate': 'Reviewed in the United States on March 12, 2026',
'customer': 'Rosmary bello',
'customerProfileUrl': 'https://www.amazon.com/gp/profile/amzn1.account.AHRYNTFNCP2HHUGJPAO55TFG3QPQ',
'customerStarsRating': 5,
'productSpecs': {'color': 'W4 Light Medium',
'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'On time delivery',
'reviewText': 'Good',
'reviewDate': 'Reviewed in the United Arab Emirates on January 21, 2026',
'customer': 'Sajjad',
'customerStarsRating': 4,
'productSpecs': {'color': 'W2 Light', 'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'Fantastic product.',
'reviewText': "Great find for me. Wouldn't go past it.",
'reviewDate': 'Reviewed in the United Kingdom on March 28, 2025',
'customer': 'blonde mel',
'customerStarsRating': 5,
'productSpecs': {'color': 'W3 Light Medium',
'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'Extremely poor quality product, very very disappointing, pls help to return it',
'reviewText': 'Item defective/ bad quality, want to return this item, very very poor quality of the product , very disappointed with this one, pictures attached, willing to return it but return window already closed one day before, but wish I could this extremely bad product.',
'reviewDate': 'Reviewed in India on July 11, 2025',
'customer': 'Triptimoy Chakraborty',
'customerStarsRating': 1,
'productSpecs': {'color': 'W6 Medium', 'size': '0.33 Ounce (Pack of 1)'}},
{'reviewTitle': 'Fab',
'reviewText': 'Lovely colour fast delivery',
'reviewDate': 'Reviewed in the United Kingdom on October 12, 2019',
'customer': 'Aimee McNamara',
'customerStarsRating': 5,
'productSpecs': {'color': 'W6 Medium',
'size': '0.33 Ounce (Pack of 1)'}}]}}}Check the top-level keys of the product detail JSON to see what information is available.
product_data["product"].keys()dict_keys(['asin', 'url', 'title', 'isAvailable', 'primaryFeatures', 'featureBullets', 'description', 'boughtInPastMonth', 'badges', 'breadcrumbs', 'variants', 'price', 'condition', 'deliveryRawDate', 'deliveryIsoDate', 'deliveryPriceMessage', 'primeMemberDeliveryRawDate', 'primeMemberDeliveryIsoDate', 'primeMemberMessage', 'primeMemberDeliveryPriceMessage', 'returns', 'seller', 'shipper', 'totalImages', 'primaryImage', 'images', 'totalVideos', 'primaryVideo', 'videos', 'specification', 'reviewsInfo'])Note that the structure of the product detail JSON contains a “product” key that holds the detailed information about the product. We can access this information by looking at the keys under product_data["product"]. This will give us insights into the various attributes available for each product, such as price, ratings, and other specifications.
In the next step of the case study, you will parse the product detail JSON files to extract specific attributes for each product and compile them into a structured format for analysis. This will involve navigating through the nested structure of the JSON and handling any potential issues such as missing keys or null values.