Returns a converter for JSON-compatible objects or values, with errors for
known-incompatible types.
Based on json, but additionally runs a check during every encode
call, throwing an error if the object contains fields which cannot be round-tripped
to JSON (Date, Map). This incurs some cost in checking each instance, but gives
clear errors rather than late serdes mismatches.
Returns a converter for JSON-compatible objects or values, with errors for known-incompatible types.
Based on
json
, but additionally runs a check during every encode call, throwing an error if the object contains fields which cannot be round-tripped to JSON (Date, Map). This incurs some cost in checking each instance, but gives clear errors rather than late serdes mismatches.Example: