Serialize a value to a parsed JSON envelope (object/array/primitive) rather
than a string. Use this when nesting functype values inside another
structured serializer (SuperJSON / DBOS custom transformers / similar)
whose custom-transformer hook expects JSON values, not strings — passing a
string to such a hook causes the host to re-walk it character-by-character,
destroying the round-trip.
Equivalent to JSON.parse(serialize(value)) but exposed as a named entry
point so consumers don't carry the parse/stringify shim.
Returns JSONValue (tightened from unknown in 1.2.2) so consumers can
drop the result straight into a host serializer's serialize hook without
a boundary cast.
Serialize a value to a parsed JSON envelope (object/array/primitive) rather than a string. Use this when nesting functype values inside another structured serializer (SuperJSON / DBOS custom transformers / similar) whose custom-transformer hook expects JSON values, not strings — passing a string to such a hook causes the host to re-walk it character-by-character, destroying the round-trip.
Equivalent to
JSON.parse(serialize(value))but exposed as a named entry point so consumers don't carry the parse/stringify shim.Returns
JSONValue(tightened fromunknownin 1.2.2) so consumers can drop the result straight into a host serializer'sserializehook without a boundary cast.