Documentrepository.parse now optionally serializes document as JSON, if config.serializejson is set