json serialization and out/err dependency injection