added 'pretty' option for nicely formatted JSON