Python script to convert hierarchical JSON to LaTeX itemize
Unless you specifically want a tab of 2 spaces in the resulting LaTeX, you can use '\t' to get the actual tab character.

TAB = '\t'


When working with strings with one or more backslashes, you can declare them as 'raw' strings by prefixing them with an r, which allows you to write backslash characters without having to escape them.

BEGIN = r'\begin{itemize}'
ITEM = r'\item {0}\hfill{{}}{1}'
END = r'\end{itemize}'


You can use the magic method iter() to get iterators, for example:

stack = [iter(data['items'])]


or

stack.append(iter(current['items']))


This is more idiomatic than calling the __iter__() method directly. In addition, there is a next() magic method as well which you can use to get the next item from an iterator.

current = next(iterator)


If you are using Python 3.4 or higher, I'd recommend checking out the pathlib module for manipulating file paths over os.path, but in this case using os.path does the job and is probably sufficient.