Convert key-value to flat file