it looks like code generator made some incorrect code for inner objects
here is an example:
as we see list puts to json directly without convertion to json array
the same for single item
https://github.com/dart-lang/json_serializable/blob/6d5948508b65d8bec873b3fc213c17c884546156/example/lib/example.g.dart#L68
it should be something like this for single
writeNotNull(
'documentImageSizeLimit', instance.documentImageSizeLimit?.toJson());
and this for list
writeNotNull('polygon', instance.polygon?.map((f) => f.toJson())?.toList());
explicitToJson: true fixes this, but i think that its quite incorrect and should be by default
i have version
json_annotation: ^3.0.1
and nested object have wrong 'toJson' generation
This bug is still happening 3.3.0.
Most helpful comment
explicitToJson: true fixes this, but i think that its quite incorrect and should be by default