Introduction to JavaScript Object Notation

Book description

What is JavaScript Object Notation (JSON) and how can you put it to work? This concise guide helps busy IT professionals get up and running quickly with this popular data interchange format, and provides a deep understanding of how JSON works. Author Lindsay Bassett begins with an overview of JSON syntax, data types, formatting, and security concerns before exploring the many ways you can apply JSON today.

From Web APIs and server-side language libraries to NoSQL databases and client-side frameworks, JSON has emerged as a viable alternative to XML for exchanging data between different platforms. If you have some programming experience and understand HTML and JavaScript, this is your book.

  • Learn why JSON syntax represents data in name-value pairs
  • Explore JSON data types, including object, string, number, and array
  • Find out how you can combat common security concerns
  • Learn how the JSON schema verifies that data is formatted correctly
  • Examine the relationship between browsers, web APIs, and JSON
  • Understand how web servers can both request and create data
  • Discover how jQuery and other client-side frameworks use JSON
  • Learn why the CouchDB NoSQL database uses JSON to store data

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Audience
    2. Approach to JSON
    3. Conventions Used in This Book
    4. Using Code Examples
    5. Safari® Books Online
    6. How to Contact Us
    7. Acknowledgments
  2. 1. What Is JSON?
    1. JSON Is a Data Interchange Format
    2. JSON Is Programming Language Independent
    3. Key Terms and Concepts
  3. 2. JSON Syntax
    1. JSON Is Based on JavaScript Object Literals
    2. Name-Value Pairs
    3. Proper JSON Syntax
    4. Syntax Validation
    5. JSON as a Document
    6. The JSON MediaType
    7. Key Terms and Concepts
  4. 3. JSON Data Types
    1. Quick Look at Data Types
    2. The JSON Data Types
    3. The JSON Object Data Type
    4. The JSON String Data Type
    5. The JSON Number Data Type
    6. The JSON Boolean Data Type
    7. The JSON null Data Type
    8. The JSON Array Data Type
    9. Key Terms and Concepts
  5. 4. JSON Schema
    1. Contracts with Validation Magic
    2. Introduction to JSON Schema
    3. Key Terms and Concepts
  6. 5. JSON Security Concerns
    1. A Quick Look at Client- and Server-Side Relationships
    2. Cross-Site Request Forgery (CSRF)
    3. Injection Attacks
      1. Cross-Site Scripting (XSS)
      2. Holes in Security: Architectural Decisions
    4. Key Terms and Concepts
  7. 6. The JavaScript XMLHttpRequest and Web APIs
    1. Web APIs
    2. The JavaScript XMLHttpRequest
    3. Relationship Woes and Rules About Sharing
      1. Cross-Origin Resource Sharing (CORS)
      2. JSON-P
    4. Key Terms and Concepts
  8. 7. JSON and Client-Side Frameworks
    1. jQuery and JSON
    2. AngularJS
    3. Key Terms and Concepts
  9. 8. JSON and NoSQL
    1. The CouchDB Database
    2. The CouchDB API
    3. Key Terms and Concepts
  10. 9. JSON on the Server Side
    1. Serializing, Deserializing, and Requesting JSON
      1. ASP.NET
      2. PHP
      3. A Smorgasbord of JSON HTTP Requests
      4. Ruby on Rails
      5. Node.js
      6. Java
    2. Key Terms and Concepts
  11. 10. Conclusion
    1. JSON as a Configuration File
    2. The Big Picture
  12. Index

Product information

  • Title: Introduction to JavaScript Object Notation
  • Author(s): Lindsay Bassett
  • Release date: August 2015
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781491929483