FuncType - v1.4.1
    Preparing search index...

    Function deserialize

    • Reconstruct any value from a JSON string. Lenient codec: walks the parsed structure and rebuilds any value carrying an @functype marker via the dispatch table; plain JSON without the marker walks through unchanged. Returns Try so 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 @functype marker is returned verbatim as Success(value); only marker-carrying values are reconstructed. Only malformed JSON (or an unknown marker) yields Failure. For a strict variant that rejects unmarked input, see deserializeStrict.

      Parameters

      • json: string

      Returns Try<unknown>

      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.