liveBook · Manning

JSON

As explained in Designing AI Systems

JSON is a text-based data interchange format for representing structured values such as objects, arrays, strings, numbers, and nested data.

JSON provides a language-neutral response format for APIs that must return structured results to JavaScript, Python, Swift, and other clients. Its text-based, human-readable representation supports straightforward parsing and debugging while preserving objects, arrays, nested values, strings, and numbers. section 2.3.4

Use JSON to keep API boundaries predictable:

  • Return fields such as a category and confidence value in one structured object. section 2.3.4
  • Keep the API response format consistent for generated files by returning an object-storage URL instead of embedding arbitrary content. section 2.3.4
  • Send request data in a POST body, avoiding GET URL-length limits and reducing exposure of sensitive values in server logs. section 2.3.4

Categorization response

A synchronous image-categorization endpoint can return {"category": "electronics", "confidence": 0.95}. Any HTTP client can parse the object and use its fields. section 2.3.4

service SessionService {
    rpc GetOrCreateSession(GetOrCreateSessionRequest)
        returns (GetOrCreateSessionResponse);
    rpc AddMessages(AddMessagesRequest)
        returns (AddMessagesResponse);
}
 
message GetOrCreateSessionRequest {
    string user_id = 1;
    optional string session_id = 2;
}

Contrast JSON at external API boundaries with Protocol Buffers used for compact, schema-defined internal service communication. section 2.4.2

How Designing AI Systems covers it

How deep it goes
Defines core structured values and practical API placement, but defers formal schemas and binary serialization.
Examples
Uses image categorization fields, research job status objects, image URLs, and streaming token events.
What you can do after
Apply it via HTTP clients to exchange and debug structured API data across programming languages.
How it connects
Connects HTTP APIs, synchronous requests, object storage, streaming, gRPC, and Protocol Buffers.

Also explained in

Compare how 42 books explain JSON →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing AI Systems. The section links point to the parts of the book it draws on.