json_serializer 0.0.2 copy "json_serializer: ^0.0.2" to clipboard
json_serializer: ^0.0.2 copied to clipboard

Automatically convert JSON to dart objects in runtime without code generation.

json_serializer #

Automatically convert JSON to dart objects in runtime without code generation.

Example #

import 'package:json_serializer/json_serializer.dart';

class Foo {
  final List<Bar> bars;

  Foo({required this.bars});
}

class Bar {
  final String value;

  Bar({required this.value});
}

main() {
  JsonSerializer.options = JsonSerializerOptions(userTypes: [
    UserType<Foo>(Foo.new),
    UserType<Bar>(Bar.new),
  ]);

  var json = '{"bars": [{"value": "a value"}]}';

  var foo = JsonSerializer.deserialize<Foo>(json);

  print(foo.bars[0].value); // a value
}
10
likes
0
points
1.82k
downloads

Publisher

verified publisheredsonbonfim.com

Weekly Downloads

Automatically convert JSON to dart objects in runtime without code generation.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

fake_reflection

More

Packages that depend on json_serializer