added support for generics
added rendering json directly into stream