[refac] refactored json traversal func