Web Scraping20 min read

Saving Data to JSON

Store structured scraped data into JSON format for APIs and modern applications.

David Miller
December 26, 2025
1.7k48

JSON is best for structured and nested data.

Write JSON

import json

data = [
  {"name": "Laptop", "price": 900},
  {"name": "Phone", "price": 500}
]

with open("products.json", "w", encoding="utf-8") as f:
    json.dump(data, f, indent=2)

Flow

flowchart LR
  A[Python Dict/List] --> B[JSON File]

Remember

  • JSON keeps structure
  • Ideal for APIs
#Python#Intermediate#Storage