JSON (javascript Object Notation) — текстовый формат обмена данными, основанный на javascript.
Beginning JSON is the definitive guide to JSON - todays standard in data formatting for the web.
The book starts with the basics, and walks you through all aspects of using the JSON format.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
# Beginning JSON — Reading Guide
## 【One-Line Pitch】
A practical, hands-on introduction to JSON as both a JavaScript concept and a universal data interchange format, ideal for web developers who want to understand serialization, parsing, and real-world data exchange from the ground up.
## 【Book Arc】
- **Opening (~0%–10%)**: JavaScript fundamentals — strings, quoting and escaping rules, primitive types, expressions, operators, and statement syntax. This stage builds the language foundation JSON depends on.
- **Early (~10%–23%)**: Objects and arrays as JavaScript data structures, including object/array literals, property access, and the String object's full method interface (indexOf, match, replace, slice, split, etc.).
- **Early (~23%–29%)**: Introducing JSON itself — its history (Douglas Crockford, RFC 4627, ECMA-404), grammar, composite structures, and valid JSON values. Establishes JSON as a subset of JavaScript, not a programming language.
- **Middle (~29%–42%)**: Serialization with JSON.stringify — how JavaScript values become JSON text, handling edge cases, using the replacer parameter for whitelisting properties, and the space parameter for formatting. Also covers browser support for the native JSON object.
- **Middle (~42%–48%)**: Deserialization with JSON.parse — converting JSON text back into JavaScript data trees, accessing members via dot/bracket notation, and using the reviver function to transform values (e.g., converting ISO date strings into Date objects).
- **Late (~48%+)**: Persisting JSON — storing serialized data for application state and interchange, moving from in-memory structures to durable storage.
## 【Key Takeaways】
- **JSON is a subset of JavaScript, not a language of its own** (Early): It inherits JavaScript's literal syntax but functions purely as a data interchange format. This distinction matters because it explains both JSON's simplicity and its limitations — you can't put functions or undefined values in JSON.
- **Quoting and escaping are the first practical hurdle** (Opening): Nested quotes inside strings confuse parsers; alternating quote styles or backslash escaping (`\"`) solves this. This is foundational because JSON strings follow the same rules.
- **Objects and arrays are the two composite structures JSON builds on** (Early): Objects are string/value pairs; arrays are ordered integer-keyed collections. Understanding their JavaScript forms directly maps to understanding JSON's grammar.
- **JSON.stringify handles serialization, but not all values serialize as expected** (Middle): The replacer parameter lets you whitelist which properties get serialized — useful when you need to exclude sensitive data like email addresses without deleting them from the source object.
- **JSON.parse reverses the process and returns a live data tree** (Middle): After parsing, you access members with dot notation (`author.name`) or bracket notation (`author.pets[0].name`). The parsed result is a plain JavaScript object, not a special JSON type.
- **The reviver function transforms values during parsing** (Middle): A common use case is detecting ISO-formatted date strings via regular expressions and converting them into actual Date objects — something JSON.stringify does not preserve natively.
- **Native JSON support is built into modern browsers** (Middle): Firefox 3.5+, Chrome 5+, Safari 4.0.5+, Opera 10.5+, and IE 8+ all include the JSON object natively; the downloadable JSON library simply checks for existing support before creating a fallback.
## 【Reading Tips】
- **Skim Chapter 1–2 if you already know JavaScript basics**: The early chapters cover strings, operators, and object/array literals thoroughly — useful for beginners, but experienced developers can jump ahead to Chapter 4 where JSON is formally introduced.
- **Deep-read Chapter 5 (stringify) and Chapter 6 (parse)**: These are the practical core. Pay special attention to the replacer and reviver parameters — they solve real-world problems like excluding sensitive fields and restoring date objects.
- **Work through the exercises**: The book includes hands-on exercises (e.g., Exercise 5-1) that involve creating HTML files and experimenting with serialization. These cement the concepts better than passive reading.
- **Watch for the "subset" theme**: The book repeatedly emphasizes that JSON is a subset of JavaScript. Keep this in mind when you encounter values that don't serialize as expected — it explains why functions, undefined, and certain objects behave oddly.
- **Note the browser support table**: If you're supporting older browsers, the compatibility table in Chapter 5 tells you when you need the JSON library fallback versus when native support suffices.
## 【Coverage Limits】
The excerpts cover JavaScript fundamentals, JSON grammar and history, stringify/parse mechanics, and persistence concepts. They do not cover advanced topics like JSON Schema validation, JSON in specific frameworks, or performance optimization at scale.
##
Page 19
e the string ends prematurely, as in the preceding example. There are two possible ways to accomplish this. Alternate Quotations Because you can alternate be...
reflect their index within the collection. Object Literals Object (with an initial capital letter) refers to the JavaScript Object type. An object refers to...
[{"name":"Waverly","age":3.5},{"name":"Westley","age":4}]}" The produced JSON captures the data precisely as it was housed within the author object. The grea...
ts[0].name) // Waverly; The magic of JSON.parse is twofold. The first proponent that allows for the transformation of JSON text into that of a JavaScript val...
itially assigned. This is strictly due to the fact that the cookie-av values are intended to be utilized by the browser alone. It is the browser’s job to ens...
main object-oriented and register the event of the state to which we choose to listen. For each event to which we listen, we can assign a particular function...
ess http://json.sandboxed.guru/chapter8/. Upon a successful reception of the request, the server would respond in kind with an entity body, which could be us...
the former option (the query string parameter). Listing 9-7. An xhr object Whose Target Resource Possesses a Query String Parameter Indicating the URI for th...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Beginning JSON (Ben Smith)(Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share to WeChat Moments
Beginning JSON (Ben Smith)(Z-Library)
Scan the QR code with WeChat to open this book
Tap the ··· menu in the top-right corner
Choose Share to Moments
You are already in WeChat. Tap ··· in the top-right corner and choose Share to Moments.
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Beginning JSON (Ben Smith)(Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment