JSON: How Data Travels
JSON
Part of: Your First API Call
Your Python script holds a dictionary. Anthropic's servers run on different code, maybe a different language, on a machine across the country. How do two strangers agree on the exact shape of a message? They both speak JSON , a plain-text format with a one-page spec that carries nearly every API request on the internet. What it is JSON (JavaScript Object Notation, despite the name it's used everywhere, not just JavaScript) is text arranged as key-value pairs inside curly braces. If you've ever filled out a form with labeled boxes (name, email, message), you already understand it. Each key (left of the colon) is a label. Each value (right of the colon) is the data. The rules are tight: strings get double quotes, numbers and true/false don't, and commas separate pairs. That's 90% of JSON. How it works The other 10%: a value can itself be a list or another box. That nesting is what lets JSON describe complex things. The square brackets [ ] hold a list. Inside it, another set of curly braces, a box inside a box. This is exactly the shape of a Claude request. Don't memorize it yet; just notice that it's labeled boxes all the way down. In Python, JSON is pleasant because a JSON object lo
Challenge: Parse the Request Body