For my json it's showing IndexError: list index out of range At line _getHierarchy(jsonData[0], '', file, _prefix, _last=True)