refactoring json converter