liveBook · Manning

JSON

As explained in Rust Servers, Services, and Apps

JSON is a text-based data-interchange format that represents structured values using objects, arrays, strings, numbers, booleans, and null.

JSON carries structured application data between files, web servers, and clients. A Rust server can load order records from orders.json and return them through an API response with an application/json content type. section 2.3.5

A Rust web application can retrieve JSON from a REST endpoint and deserialize the payload into a strongly typed Vec<Tutor> using serde_json and a matching Rust struct. section 7.7

Orders served through an API

The orders.json file contains an array of objects with order_id, order_date, and order_status fields. The server exposes these records at /api/shipping/orders, while a browser or curl client verifies the response. section 2.3.5

Tutor-list deserialization

The Actix Web handler requests http://localhost:3000/tutors/, reads the response body, converts it with serde_json, and passes the resulting tutors to a Tera template. section 7.7

Listing 2.30 The JSON data file for orders (httpserver/data/orders.json)
[
    {
        "order_id": 1,
        "order_date": "21 Jan 2020",
        "order_status": "Delivered"
    },
    {
        "order_id": 2,
        "order_date": "2 Feb 2020",
        "order_status": "Pending"
    }
]

Inspect the concrete orders.json artifact used as the server's JSON data source. section 2.3.5

How Rust Servers, Services, and Apps covers it

How deep it goes
Demonstrates JSON files, HTTP responses, and typed deserialization, but does not develop the format's grammar or parsing internals.
Examples
Uses orders.json records and a tutor-list payload rendered through a Tera template.
What it assumes
Assumes Rust structs, HTTP request handling, web servers, and REST endpoints while teaching JSON parsing within that request flow.
What you can do after
Apply it via serde_json to deserialize service responses into Vec<Tutor> and serve JSON from a Rust web server.
How it connects
Connects JSON with HTTP responses, REST APIs, serde_json, Serde, Actix Web, Rust structs, and Tera templates.

Also explained in

Compare how 35 books explain JSON →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.