A lightweight JSON RPC client & server
Home > async-call-rpc > JSONEncoderOptions > keepUndefined
How to handle "undefined"
in the result of SuccessResponse.
Signature:
keepUndefined?: false | 'null' | undefined;
If you need a full support of encoding undefined
, for example, when the result is { field: undefined }
and you want to keep it, you need to find another library to do this.
If this is not handled properly, JSON.stringify
will emit an invalid JSON-RPC object (fields with undefined
value will be omitted).
Options: - "null"
(**default**): convert it to null
. - false
: do not do anything, let it break.