further refactoring of json to map