refactoring with json