Json: refactoring