Skip to content

Add casting support #137

Closed
Closed
@ianldgs

Description

@ianldgs

I've integrated with a very bad API. Their JSON didn't have any types, it was all strings. It would be very usefull to have something like this:

{
  "ugly": "true",
}
@JsonSerializable()
class Example {
  Example({this.pretty});

  @JsonKey(
    name: 'ugly',
    fromJson: (v) => v == 'true',
    toJson: (v) => v.toString(),
  )
  final bool pretty;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions