refactor and init to json mapper