title: How can we consume JSON data using OPENUI5/SAPUI5?
body: <p>I am new to SAPUI5/OPENUI5.
  I am trying out a sample program to consume json data from a domain and display it in my openui5 table. I have tried two methods to get the data and bind it to table control.But I am not able to generate the table with the json data. 
  Please let me know my mistake in the code.
  And also please refer me some links to understand the concept in a better way.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Please find the two approaches below :</p>
  
  <p>JSON Data :</p>
  
  <pre><code>[
    {
      "name": "Rajesh"
    },
    {
      "name": "Kunal Jauhari"
    },
    {
      "name": "Ashish Singh"
    },
    {
      "name": "Ansuman Parhi"
    },
    {
      "name": "Arup Kumar"
    },
    {
      "name": "Deepak Malviya"
    },
    {
      "name": "Seshu"
    },
    {
      "name": "Ankush Datey"
    },
    {
      "name": "Tapesh Syawaria"
    },
    {
      "name": "Mahesh"
    },
    {
      "name": "Vinay Joshi"
    },
    {
      "name": "Ardhendu Karna"
    },
    {
      "name": "Abhishek Shukla"
    },
    {
      "name": "Kashim"
    },
    {
      "name": "Vinayak"
    }
  ]
  </code></pre>
  
  <p>Approach 1 : I am using a php file to echo the JSON data and use it in my ui5 screen.
  When I access the run the php file individually, it generates the data and prints the data on screen.</p>
  
  <p>Error I get is getJSON is not called.</p>
  
  <p>Code : </p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
          &lt;meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/&gt;
  
  
          &lt;script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
                  id="sap-ui-bootstrap"
                  data-sap-ui-libs="sap.ui.commons,sap.ui.table"
                  data-sap-ui-theme="sap_bluecrystal"&gt;
          &lt;/script&gt;
          &lt;!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required --&gt;
  
          &lt;script&gt;
          var json_url = "http://mydomain/teamdetails_ui5.php?t=6";
              $.ajax({
                  url : json_url,
                  jsonpCallback : 'getJSON',  
                  contentType : "application/json",
                  dataType: 'jsonp',
  
  
                  success: function(data,textStatus,jqXHR) {
                      oModel.setData({data: data});
                      sap.ui.getCore().setModel(oModel);
  
                      var oTable1 = new sap.ui.table.Table({  
                          title : "Players List",  
                          visibleRowCount : 3,  
                          selectionMode : sap.ui.table.SelectionMode.Single,  
                          navigationMode : sap.ui.table.NavigationMode.Paginator,  
                      });
  
                      //Define the columns and the control templates to be used    
                      oTable1.addColumn(new sap.ui.table.Column({  
                          label : new sap.ui.commons.Label({  
                          text : "Player Name"  
                      }),  
                      template : new sap.ui.commons.TextView().bindProperty(  
                      "text", "name"),  
                      width : "10px"  
                      }));
  
                      oTable1.setModel(oModel);  
                      oTable1.bindRows("/oModel");  
                      oTable1.placeAt('table_cont');  
  
                  },
                  error : function(jqXHR,textStatus,errorThrown) {
                      alert("Oh no, an error occurred");
                      alert(jqXHR);
                      alert(textStatus);
                      alert(errorThrown);             
                  }
              });
  
          &lt;/script&gt;
  
      &lt;/head&gt;
      &lt;body class="sapUiBody" role="application"&gt;
          &lt;div id="table_cont"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Approach 2 : I am trying to access the JSON file directly on my domain and access the data.</p>
  
  <p>Code is the same as above except url.
  Url is used for this approach is (mydomain/players.json) where players.json contain the above json data.</p>
  
  <p>Please help me in understanding the concept of JSON data handling.</p>
  
  <p>Regards,
  Rajan</p>