Support for bson and json as input