Web Scraping21 min read
Saving Data to JSON
Store structured scraped data into JSON format for APIs and modern applications.
David Miller
Dec 27, 2025
6,513227
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