fixed JSON output of latlon, tidyed code a little