Hi,
I have a singleton type Undefined
which is meant to match JavaScript’s undefined
primitive. As such, when JSON rendered, this should output as undefined
instead of the default "undefined"
(not wrapped in double quotes, similar to how Nothing
renders as null
or Bool
as true
or false
).
Specializing JSON.lower
seems to do the trick partially, but I don’t know what to output in the specialization so that the output is not wrapped in quotes.
For example, this results in null
because Base.print
returns nothing
. How can I return the undecorated/unquoted string or how can this be done?
JSON.lower(::Undefined) = Base.print("undefined")
Thank you