Learning web development: JSON and processing files in Node.js
Briefly

JSON (JavaScript Object Notation) encodes data as text and uses a subset of JavaScript syntax so each JSON value is a valid JavaScript expression. Supported primitive values include null, booleans, numbers (excluding NaN and infinite values), and strings that must use double quotes. Objects and arrays are created with literals; object property keys must be double-quoted. Trailing commas are not allowed in objects or arrays. JSON does not support undefined. Parsing converts JSON text into JavaScript values via JSON.parse(), and JSON strings can encode strings that contain other, escaped strings.
JSON ("JavaScript Object Notation") is a way of encoding data as text - e.g., in text files. Its syntax is a subset of JavaScript. In other words: Each piece of JSON data is valid JavaScript source code - it's an expression. This is an example of a text file with JSON data: The syntax of JSON # The syntax of JSON works as follows:
JSON supports the following primitive values: null. null is a non-value that is similar to undefined. undefined is not supported by JSON. Booleans Numbers, but not the error values NaN, +Infinity, -Infinity Strings - which must be double-quoted. Single quotes and backticks are not allowed as delimiters. Objects can be created via two literals: Object literals create plain objects. Property keys must be double-quoted. That's a JavaScript feature we haven't seen yet. It lets us use spaces and other normally illegal characters in property names. Property values must be legal JSON values. Trailing commas are not allowed. Array literals create arrays. The array elements must be legal JSON values. Trailing commas are not allowed.
Parsing JSON via JSON.parse() # Parsing JSON means converting text to a JavaScript value: Parsing a JSON string that encodes a string is interesting because it's a string that contains another string.
Read at 2ality
[
|
]