Export TIR to json

TIR already has textual representation, so why not make sure it’s parseable, and then just write a parser for it?