DRY up JSON pretty printing
Fix typo in comments