how to convert text file to json in javascript
<p>I have a text file like the one below</p>

<pre><code>id      nm              lat         lon         countryCode
819827  Razvilka        55.591667   37.740833   RU
524901  Moscow          55.752220   37.615555   RU
1271881 Firozpur        27.799999   76.949997   IN
</code></pre>

<p>i need to to convert to json like the format below</p>

<pre><code>[{"id":819827,"nm":"Razvilka","lat":55.591667,"lon":37.740833,"countryCode":"RU"},
{"id":524901,"nm":"Moscow","lat":55.752220,"lon":37.615555,"countryCode":"RU"},
{"id":1271881,"nm":"Firozpur","lat":27.799999,"lon":76.949997,"countryCode":"IN"}]
</code></pre>

<p>for a javascript application.</p>

<pre><code>myapp.controller('TCtrl', ['$scope', '$http', function($scope, $http) {
  $http.get('list.txt').success(function(data) {
    $scope.todos = JSON.parse(data);
    //console.log(data)
  });
}]);
</code></pre>