Encode a plain data value as artifact bytes that decodeAutoMovieArtifactJson
restores exactly.
JSON alone loses -0, NaN and the infinities and silently flattens typed
arrays, maps and class instances, any of which would make a cached result
differ from a computed one. This encoder writes the four special numbers as
{"$number": "-0" | "NaN" | "Infinity" | "-Infinity"} and refuses every
value that is not null, a boolean, a string, a finite number, an array or a
plain object (prototype Object.prototype or null), and any plain object
owning a $number member, so whatever it accepts decodes to a deeply equal
value. Object member order is kept; undefined members are omitted as JSON
omits them, and an undefined array element refuses. Shared references are
written once per occurrence, so identity between branches is not preserved.
Encode a plain data value as artifact bytes that
decodeAutoMovieArtifactJsonrestores exactly.JSON alone loses
-0,NaNand the infinities and silently flattens typed arrays, maps and class instances, any of which would make a cached result differ from a computed one. This encoder writes the four special numbers as{"$number": "-0" | "NaN" | "Infinity" | "-Infinity"}and refuses every value that is notnull, a boolean, a string, a finite number, an array or a plain object (prototypeObject.prototypeornull), and any plain object owning a$numbermember, so whatever it accepts decodes to a deeply equal value. Object member order is kept;undefinedmembers are omitted as JSON omits them, and anundefinedarray element refuses. Shared references are written once per occurrence, so identity between branches is not preserved.