JSON is a text-based format for exchanging structured data between software. FastAPI converts a JSON-serializable Python dictionary into a response, while Express.js returns JSON for microservice communication. section 2.1.2 section 2.2.3
Web applications use JSON by:
- Returning a Python dictionary that supports JSON serialization from a FastAPI route. section 2.1.2
- Declaring a JavaScript object, converting it with JSON.stringify(), and returning it through Express.js. section 2.2.3
FastAPI response
A route such as / can return {"Hello": "World"}; FastAPI converts the JSON-serializable Python dictionary into JSON data.
Express.js response
An Express.js route can create {who: "rocket man", where: "mars"}, convert it with JSON.stringify(), and return the result with res.json().


































