Lesson 19 of 19
Basic APIs & JSON
Exchange structured data with web services.
Introduction
An API exposes operations over HTTP. JSON represents data with objects, arrays, strings, numbers and booleans.
Python's json module converts between JSON text and Python dictionaries or lists.
Key insight
Exchange structured data with web services.
Example
import json
payload = json.loads('{"name": "Asha"}')
print(payload["name"])This example shows the core basic apis & json idea in a small, runnable program.
Real-world example
A weather dashboard requests JSON from an API and displays selected fields.
Test yourself
2-question check
1
What is the main idea in Basic APIs & JSON?
2
Where can basic apis & json be useful?
Ready to check your understanding?
Answer every question, then submit your quiz.
Try it yourself
Python compiler
Runs in your browser. Nothing is sent to a server.
Output appears here
First run downloads the Python runtime, so it may take a moment.
Practice challenge
Convert a Python dictionary to a JSON string.