toJson abstract method

Object? toJson({
  1. Object? substituteValue,
  2. bool allowMalformedUtf8 = false,
})

Transform this into a JSON encodable value.

substituteValue will be used for values that cannot be encoded, such as double.infinity, double.nan, CborUndefined.

If the keys for a map are not strings, they are encoded recursively as JSON, and the string is used.

Implementation

Object? toJson({
  Object? substituteValue,
  bool allowMalformedUtf8 = false,
});