So far I've been using a simple factory pattern for this. Assuming all your JSON objects have some kind or type field you can look up a factory / deserializer in a map:
typedef Object Factory(Map map);
Map<String, Factory> getFactories() => {
"foo": (m) => new Foo.fromMap(m),
"bar": (m) => new Bar.fromMap(m),
}
Object create(String json) {
var map = JSON.parse(json);
Factory factory = getFactories()[map["type"]];
return factory(map);
}
There's some working code here, also for a command library:
Hope that helps,
Justin