Extracted common code from okjson and jrjackson adapters