title: Parsing json data in angular?
body: <p>I am trying angular for the first time and I am pretty stuck.This is the JSON data that I am receiving from an API-</p>
  
  <pre><code>{
      "coord": {
          "lon": 72.85,
          "lat": 19.01
      },
      "weather": [
          {
              "id": 803,
              "main": "Clouds",
              "description": "broken clouds",
              "icon": "04d"
          }
      ],
      "base": "stations",
      "main": {
          "temp": 301.828,
          "pressure": 1021.02,
          "humidity": 100,
          "temp_min": 301.828,
          "temp_max": 301.828,
          "sea_level": 1022.28,
          "grnd_level": 1021.02
      },
      "wind": {
          "speed": 3.52,
          "deg": 246.002
      },
      "clouds": {
          "all": 80
      },
      "dt": 1442131167,
      "id": 1275339,
      "name": "Mumbai",
      "cod": 200
  }
  </code></pre>
  
  <p>This is my function in controller-</p>
  
  <pre><code>(
  function () {
      var app=angular.module("weather",[]);
      var query="";
      app.controller("search",function(){
          query="mumbai";
  
      });
  
      app.controller("result",['$http','$scope',function($http,$scope){
  
          var city=query;
          $http({
              url:'http://api.openweathermap.org/data/2.5/weather',
              method:'GET',
              params:{q:city}
          }).then(function (response) {
  
              console.log(response);
              console.log(response.name);
  
          },function (response){
              //error message
          });
  
  
      }]);
  }
  )();
  </code></pre>
  
  <p>Following are the console messages-</p>
  
  <p><a href="https://i.stack.imgur.com/TvsCO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TvsCO.jpg" alt="enter image description here"></a></p>
  
  <p>So I am not able to understand that if <code>console.log(response)</code> is showing <code>Object</code> then why <code>console.log(response.name)</code> is showing undefined instead of "Mumbai".</p>
  
  <p>Suggest a possible solution.</p>
  
  <p>EDIT -
  Solution found :
  Console.log(response.data.name);
  seen the docs</p>