We're using schema$serialise() to serialise an R list, created by reading in a json config file, using R to resolve pointers within in order to be able to then validate it against a schema. We are using schema$serialise() in order to get around the problems created by unboxing (with TRUE or FALSE) when using jsonlite::toJSON to re-serialise.
The problem we are having is how NA and null values are being serialised with schema$serialise().
NAs are being converted to null in the resulting JSON while NULLs are being converted to empty values which seems to be the default behaviour of toJSON. I was wondering if it would be possible to expose toJSON arguments na and null to allow for controlling the behaviour during serialisation?
Issue related to #64
We're using
schema$serialise()
to serialise an R list, created by reading in a json config file, using R to resolve pointers within in order to be able to then validate it against a schema. We are usingschema$serialise()
in order to get around the problems created by unboxing (withTRUE
orFALSE
) when usingjsonlite::toJSON
to re-serialise.The problem we are having is how
NA
and null values are being serialised withschema$serialise()
.NA
s are being converted tonull
in the resulting JSON whileNULL
s are being converted to empty values which seems to be the default behaviour oftoJSON
. I was wondering if it would be possible to exposetoJSON
argumentsna
andnull
to allow for controlling the behaviour during serialisation?Reproducible example
Created on 2022-11-21 with reprex v2.0.2