finished refactoring of the json parsing