const result = Serialization.deserialize('{"@functype":"Either","_tag":"Right","value":5}')
result.fold(e => console.error(e), v => console.log(v)) // → Right(5)
// Plain (non-functype) values pass through:
Serialization.deserialize('{"name":"alice","age":30}') // → Success({name, age})
// Embedding in another structured serializer (SuperJSON, DBOS)? See
// `fromEnvelope` — taking a string here forces the consumer through a
// JSON.stringify shim and SuperJSON re-walks strings character-by-character.
Reconstruct any value from a JSON string. Lenient codec: walks the parsed structure and rebuilds any value carrying an
@functypemarker via the dispatch table; plain JSON without the marker walks through unchanged. ReturnsTryso malformed JSON or unknown markers are expressible values rather than thrown — matches the functype convention for expected-failure paths.Pass-through policy: valid JSON without an
@functypemarker is returned verbatim asSuccess(value); only marker-carrying values are reconstructed. Only malformed JSON (or an unknown marker) yieldsFailure. For a strict variant that rejects unmarked input, seedeserializeStrict.