Simplify until_found_end_if() in template
Fix crash when outputting JSON output in freegeoip sample app

Closes #44.