JSON is a lightweight text format for transferring structured data between clients and servers. It organizes information as key-value pairs, much like a Python dictionary, and offers a less verbose alternative to XML. section 9.3.2
A practical use is sending model features in a POST request. An API can validate fields such as total_day_minutes, total_day_calls, and num_customer_service_calls, then return a JSON prediction such as prob_of_churn. section 9.3.2
Sending prediction inputs
A Python client places feature values in a dictionary and passes them with requests.post(..., json=inputs). Reading resp.json() retrieves the returned prediction. section 9.3.2
Listing 9.19 Use uvicorn to launch the test API
import requests #1
inputs = {"total_day_minutes": 10.2, #2
"total_day_calls":4,
"num_customer_service_calls": 1}
resp = requests.post( #3
"http://127.0.0.1:8000/churn",
json = inputs)
print(resp.json()) #4
Inspect a focused Python example that sends JSON feature values to a churn-prediction endpoint and reads the JSON response. section 9.3.2
JSON also appears inside Jupyter Notebook files alongside HTML, Markdown, source code, and images. That mixture makes notebook differences and merge conflicts harder for Git to identify directly. section 2.8









































