JSON
JSON is a text format for data. JSON.stringify serializes supported values; JSON.parse reads valid JSON text into JavaScript values.
An object in memory and a text representation of it are different things.
See the mechanism
object AFollow one example
stringify returns text. parse constructs a new record from that text, so its title is preserved but its identity differs from article. JSON does not encode functions, undefined or circular references as ordinary values; BigInt requires explicit handling. Parsing untrusted text can fail and parsed data still needs shape validation.
Predict, change and check
Predict: Will changing restored.saved also change article.saved?
Test your explanation: Mutate the restored record and inspect both. Then try parsing malformed JSON and observe the error; handle it after studying try/catch.
The tasks below ask you to explain that result and apply the idea to different inputs.
Apply and distinguish
A supported representation is a contract
JSON supports text, finite numeric literals, booleans, null, arrays and objects with string keys. It does not encode JavaScript identity, functions or symbol keys. undefined in an object property and undefined in an array are handled differently during serialization. A circular reference causes ordinary JSON.stringify to fail.
JSON.parse can return a primitive value or a record with unexpected fields. Parsing success is not schema validation. For a persisted record, define required fields and compatible versioning before reading it as trusted application state. Do not label a JSON round-trip a universal deep clone: it loses or rejects values outside its representation.
Check your understanding: State the input contract, identify the operation that changes the result, and give one boundary input that would distinguish the correct rule from the mistake described above.