Skip to content

dart-ecosystem/rson.dart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rson

A Dart serialization/deserialization library to convert Dart Objects into JSON and back

Important Notice

  1. One serializable class per file.
  2. No duplicated serializable class name.
  3. Do NOT pass generic type to Rson.fromJson;

Usage

  1. Setup a serializable class by decorating with @Serializable()
import "package:rson/rson.dart";

@Serializable()
class Entity {
  int a;
}
  1. Serialization
void main() {
  var entity = new Entity();
  entity.a = 1;
  print(Rson.toJson(entity)); // output: {"a":1}
}
  1. Deserialization
void main() {
  var entity = Rson.fromJson<Entity>({"a": 1});
  print(entity.a); // output: 1
}

About

A Dart serialization/deserialization library to convert Dart Objects into JSON and back

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages