dart_json 2.0.0 copy "dart_json: ^2.0.0" to clipboard
dart_json: ^2.0.0 copied to clipboard

A easy to use json to object deserializer and object to json serializer for dart

example/main.dart

import 'package:dart_json/dart_json.dart';

class Person {
  @JsonProperty("first_name")
  String firstName;

  String lastName;

  int age;
}

void main() {
  var json = '{"first_name": "Max", "lastName": "Mustermann", "age": 25}';
  Person p = Json.deserialize<Person>(json);
  print(p.firstName); // Max
  print(p.lastName); // Mustermann
  print(p.age); // 25

  var newJson = Json.serialize(p);
  print(newJson); // {"first_name":"Max","lastName":"Mustermann","age":25}
}
12
likes
40
pub points
33%
popularity

Publisher

verified publishermintware.de

A easy to use json to object deserializer and object to json serializer for dart

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on dart_json