refactoring JSON protocol...