tree traversal with JSON