Got it! scala Try is neat!
Add .toString after .get call.
Also write the json string to the output file.