liveBook · Manning

JSON

As explained in Software Engineering for Data Scientists

JSON is a text-based data-interchange format that represents structured data using objects, arrays, values, and name-value pairs.

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

How Software Engineering for Data Scientists covers it

How deep it goes
Defines key-value data transfer and shows API examples, but stops short of specifying the complete JSON syntax or parsing internals.
Examples
Uses churn-model feature dictionaries, JSON prediction responses, and Jupyter Notebook files containing code, markup, HTML, and images.
What it assumes
Assumes basic familiarity with Python dictionaries, HTTP POST requests, and Jupyter Notebooks.
What you can do after
Apply it via Python requests to send model features and read prediction responses from an API.
How it connects
Connects JSON with Python dictionaries, XML, FastAPI, POST requests, Pydantic validation, Jupyter Notebook files, and Git.

Also explained in

Compare how 42 books explain JSON →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Engineering for Data Scientists. The section links point to the parts of the book it draws on.