Phase 0 · Tools · Working with data
JSON
The text format APIs and LLMs use to exchange structured data.
Why it matters
JSON is the format the internet uses to send structured data, and it's how you talk to LLMs in code. Every request to a model API is a JSON object, every reply comes back as JSON, and when you ask a model for structured output ("give me the sentiment and three keywords"), you ask for JSON and then parse it. Once you're fluent here, API responses stop looking like walls of brackets.
What you'll be able to do
- Turn JSON text into Python data with json.loads, and back with json.dumps
- Map each JSON type to its Python equivalent
- Reach values buried in nested JSON with keys and indexes
- Format JSON readably and recognize invalid JSON
Before this lesson
Next in this phase: Files and CSV data