Ah okay, I thought you were aiming for a Pandoc YAML metadata block. If not, disregard the above notes on formatting.
As an aside, I made a compile Format for producing JSON straight out of the compiler, that might be helpful, or more straight-forward than creating an intermediary .txt and then making a script to process that into JSON.