Introduction
- The JSON Paradox
- What You’ll Learn
- Who This Book Is For
- How to Use This Book
- What You’ll Build
- A Note on Evolution
Part I: The JSON Ecosystem
Chapter 1: Origins, Evolution, and the Cracks in the Foundation
- The Pre-JSON Dark Ages: XML Everywhere
- JSON’s Accidental Discovery
- Why JSON Won
- JSON’s Fundamental Weaknesses
- The Format Comparison Landscape
- When NOT to Use JSON
- The Evolution: JSON’s Ecosystem Response
- Running Example: Building a User API
- Conclusion: JSON’s Success Through Simplicity
- Further Reading
Chapter 2: The Modular Architecture
- The Architectural Zeitgeist
- Monolithic Architecture: The XML Approach
- Modular Architecture: The JSON Approach
- The Modularity Pattern in Other Systems
- Why XML’s Completeness Became Rigidity
- How JSON’s Incompleteness Enables Evolution
- The Modularity Paradox
- Principles of Composable Solutions
- The Architecture Timeline: How Thinking Changed
- Applying the Architectural Lens
- The Core Thesis: Technologies Reflect Their Era
- Summary: The Modular Foundation
- Further Reading
Chapter 3: JSON Schema and the Art of Validation
- Running Example: Validating Our User API
- The Core Problem: Trust Nothing
- JSON Schema Fundamentals
- Core Validation Types
- Schema Composition: Building Complex Schemas
- Schema Reuse and References
- Validation in Practice: Code Examples
- Code Generation from Schemas
- OpenAPI Integration
- Schema Evolution and Versioning
- Best Practices
- Common Pitfalls
- Alternatives to JSON Schema
- Real-World Use Cases
- Conclusion: JSON + Schema = Type Safety
- Further Reading
Chapter 4: Binary JSON in Databases
- Running Example: Storing 10 Million Users
- The Text Format Tax in Databases
- The Database Binary JSON Landscape
- PostgreSQL JSONB: Indexable Documents
- MongoDB BSON: Extended Types
- Real-World Production Examples
- Choosing Database Binary JSON
- Database Performance Impact
- What’s Next: Beyond Database Storage
- References
Chapter 5: Binary JSON for APIs and Data Transfer
- MessagePack: Universal Binary Serialization
- Running Example: Optimizing User API for Mobile Clients
- CBOR: Concise Binary Object Representation
- Performance Benchmarks
- Binary JSON vs Protocol Buffers
- Cloud Bandwidth Cost Savings
- Real-World Use Cases
- Choosing Your Binary Format
- References
Chapter 6: JSON-RPC - When REST Isn’t Enough
- Running Example: User API with JSON-RPC
- The RPC Problem
- What is JSON-RPC?
- Parameter Formats
- Standard Error Codes
- Batch Requests
- Implementing a JSON-RPC Server
- Implementing a JSON-RPC Client
- JSON-RPC over WebSockets
- Real-World Use Cases
- JSON-RPC vs REST vs gRPC
- Best Practices
- Security Considerations
- Testing JSON-RPC APIs
- Conclusion: JSON-RPC’s Sweet Spot
- Further Reading
Chapter 7: JSON Lines - Processing Gigabytes Without Running Out of Memory
- Running Example: Exporting 10 Million Users
- The Streaming Problem
- JSON Lines Format
- Reading JSON Lines
- Writing JSON Lines
- Unix Pipeline Integration
- Log Processing with JSON Lines
- Data Pipelines with JSON Lines
- MongoDB and JSON Lines
- Real-World Use Cases
- Fault Tolerance
- Streaming vs Batch Processing
- Advanced Streaming Patterns
- Best Practices
- Tools and Libraries
- Common Patterns
- When NOT to Use JSON Lines
- Conclusion: JSON Lines for Scale
- Further Reading
Chapter 8: JSON Security - Authentication, Signatures, and Attacks
- Running Example: Securing the User API
- The Security Problem
- JWT: JSON Web Tokens
- JWS: JSON Web Signature
- JWE: JSON Web Encryption
- Canonicalization: Consistent Signatures
- Common Attacks and Vulnerabilities
- Best Practices
- Real-World Examples
- Running Example Complete: The Full User API Stack
- Conclusion: Security Through Modularity
- Further Reading
Chapter 9: Lessons from the JSON Revolution
- The Full Circle: JSON Recreated XML’s Ecosystem
- The Modularity Paradox: Discovery vs. Choice
- The JSX Vindication: Good Patterns Survive
- What JSON Teaches Us About Technology Evolution
- The Modularity Tax: What We Gave Up
- What Comes After JSON?
- Applying These Lessons
- The Book in Retrospect
- Conclusion: Patterns Survive, Architectures Evolve
- Further Reflection
Part II: Building with JSON
Chapter 10: Human-Friendly JSON Variants
- The Configuration Problem
- JSON5: ECMAScript 5 for Configs
- YAML: The DevOps Standard
- TOML: Clarity Over Terseness
- JSON5 vs HJSON vs YAML vs TOML: Choosing Your Format
- Migration Strategies
- Conclusion: Configuration Deserves Better Than JSON
Chapter 11: API Design with JSON
- 1. REST API Fundamentals
- 2. Pagination Patterns
- 3. Error Response Formats
- 4. API Versioning Strategies
- 5. Rate Limiting
- 6. Content Negotiation
- 7. Security Patterns
- Conclusion
Chapter 12: JSON in Data Pipelines
- 1. ETL Fundamentals with JSON Lines
- 2. Kafka Integration for JSON Streaming
- 3. Data Validation in Pipelines
- 4. Error Handling and Resilience
- 5. Monitoring and Observability
- 6. Production Pipeline Architectures
- Conclusion
Chapter 13: Testing JSON Systems
- 1. Schema-Based Testing
- 2. Contract Testing with Pact
- 3. API Testing Strategies
- 4. Security Testing
- 5. Performance and Load Testing
- 6. Fuzz Testing and CI/CD Integration
Chapter 14: Beyond JSON - The Future
- When JSON Isn’t Enough
- Protocol Buffers: Schema-First Performance
- Apache Avro: Self-Describing Data Evolution
- Emerging Patterns: Beyond Binary vs Text
- JSON in New Contexts
- Technology Landscape: 2025 and Beyond
- Conclusion: Choose Tools for Problems, Not Trends
Conclusion
- The Journey We’ve Taken
- Core Principles Learned
- Practical Takeaways
- What’s Next for JSON
- Your Next Steps
Appendix A: JSON Specification Summary
- JSON Syntax Quick Reference
- JSON Schema Essentials
- JWT Quick Reference
- HTTP Status Codes for JSON APIs
- Content-Type Headers
- Common JSON API Patterns
- JSON Lines Format
- Binary Format Comparison
Appendix B: Quick Reference Guide
- JSON Schema Validation Examples
- Error Response Formats
- Pagination Patterns
- JWT Implementation Examples
- JSON Lines Streaming Examples
- API Versioning Examples
- Webhook Payload Formats
- Batch Request Patterns
- Security Headers and Configuration
- Testing Strategy Checklists
- Configuration Examples
- Monitoring and Observability
Appendix C: Resources and Further Reading
- Essential Tools and Libraries
- Recommended Reading
- Community Resources
- Language-Specific Resources
- Staying Current with JSON Ecosystem
- Contributing to the JSON Ecosystem
- Companion Repository
About the Author
- Connect
- Speaking & Consulting
- Acknowledgments
Feedback and Errata
- Found an Issue?
- Companion Repository
- Stay Connected