title: Converting ODataModel into JSON Model
body: <p>Because of problems with reading all lines of a UI5 common table and the <code>getModel()</code> method from table offers a model.  </p>
  
  <p>I thought I could use a JSONModel instead of my ODataModel, the problem now is how to get the ODataModel to the JSONModel.<br>
  Because JSON offers some Two Way Binding options which should be helpful.</p>
  
  <p>I tried to read some set and bind it to the JSONModel, the problem is that I couldn't bind the new model two the view because it doesn't offer some set. </p>
  
  <p>Here is a snippet of my code. Hopefully this should be easier too fix as the reading all table rows:</p>
  
  <pre><code>//Erstellung des Modells
  var oModel2 = new sap.ui.model.odata.ODataModel(url, true, username, password);
  var oModel = new JSONModel(jQuery.sap.getModulePath("QuickStartApplication.model", "/Search.json"));
  
  oModel2.setSizeLimit(8000000);
  var pspJSONModel = new sap.ui.model.json.JSONModel();
  var oODataJSONModelDLSet = new sap.ui.model.json.JSONModel();
  var oODataJSONModelProjectSet = new sap.ui.model.json.JSONModel();
  var oODataJSONModelPSPset = new sap.ui.model.json.JSONModel();
  var debitorJSONModel = new sap.ui.model.json.JSONModel();
  this.getView().setModel(pspJSONModel, "jsonmodel2");
  this.getView().setModel(oODataJSONModelDLSet, "jsonmodel");
  this.getView().setModel(oODataJSONModelProjectSet, "jsonmodel3");
  this.getView().setModel(oODataJSONModelPSPset, "jsonmodel4");
  this.getView().setModel(debitorJSONModel, "jsonmodel5");
  this.getView().setModel(oModel, "saves");
  // etc
  
  oModel2.read("/SEARCH_DLSet", null, null, false, function (oData, oResponse) {
      oODataJSONModelDLSet.setData({ DLSet: oData });
  });
  oModel2.read("/Search_ProjectsSet", null, null, false, function (oData, oResponse) {
      oODataJSONModelProjectSet.setData({ ProjectSet: oData });
  });
  oModel2.read("/SEARCH_PSPSet", null, null, false, function (oData, oResponse) {
      oODataJSONModelPSPset.setData({ PSPset: oData });
  });
  oModel2.read("/DebitorSet", null, null, false, function (oData, oResponse) {
      debitorJSONModel.setData({ DebitorSet: oData });
  });
  oModel2.read("/PSPSet", null, null, false, function (oData, oResponse) {
      pspJSONModel.setData({ Pspset2: oData });
  });
  var json1 = pspJSONModel.getJSON();
  var json2 = oODataJSONModelDLSet.getJSON();
  </code></pre>
  
  <p>I saw that the table row binding has found the correct length of the data that it should get but the column binding won't work. Here is a code snippet of row binding and then the column</p>
  
  <pre><code>                            &lt;Text text="PSP(A-Nr.)" class="sapUiResponsiveMargin" &gt;&lt;/Text&gt;
                              &lt;ComboBox id="combo1"  items="{path: 'jsonmodel2&gt;/Pspset2/results'}"&gt;
                                  &lt;core:Item key="{jsonmodel2&gt;Psp}" text="{jsonmodel2&gt;Psp}" /&gt;
                              &lt;/ComboBox&gt;         
  
                              &lt;Text text="Abrechnungsstatus" class="sapUiResponsiveMargin" &gt;&lt;/Text&gt;
                              &lt;ComboBox id="Abrechnungsstatus"&gt;&lt;/ComboBox&gt;                    
                          &lt;/l:VerticalLayout&gt;
                      &lt;/l:HorizontalLayout&gt;
                  &lt;/l:VerticalLayout&gt; 
               &lt;/l:HorizontalLayout&gt; 
               &lt;/ScrollContainer&gt; 
           &lt;/Panel&gt;   
       &lt;Panel visible="false" height="80%" width="98%" id="__layout15" class="__layout5"&gt;
  &lt;Button text="Edit" id="edit" type="Transparent" class="buttons" press="onEditRow"&gt; &lt;/Button&gt;
          &lt;t:Table class="table0" id="table1" selectionMode="MultiToggle" rows="{jsonmodel&gt;/DLSet/results}"&gt;
              &lt;t:columns&gt;
                  &lt;t:Column class="columns"  width="105px"&gt;
                      &lt;Label text="Kontrakt Nr." id="lKontrakt" &gt;
                      &lt;/Label&gt;    
                      &lt;t:template&gt;
                          &lt;commons:TextField id="Kontrakt" editable="false" value="{jsonmodel&gt;KontraktNr}" &gt;&lt;/commons:TextField&gt;
                      &lt;/t:template&gt;                   
                  &lt;/t:Column&gt;
  </code></pre>
  
  <p>Also my two OData Models got on first binding property the set name under sPath but my new one won't get this property.</p>
  
  <p>Here are some Screens from debugging:</p>
  
  <p><a href="https://i.stack.imgur.com/Tqk7X.png" rel="nofollow noreferrer">OModel 1 with first property of binding</a></p>
  
  <p><a href="https://i.stack.imgur.com/jHOwT.png" rel="nofollow noreferrer">New Model with first property of binding but no right path</a></p>
  
  <p>Update examples of how the json Result looks like:<br>
  PSPSet:  </p>
  
  <pre><code>{
    "Pspset2": {
      "results": [
        {
          "__metadata": {
            "id": "http://hvw-sapdev01.oms-sap.omnisys.de:8000/sap/opu/odata/SAP/Z_TBRKNPRO_SEARCH_DL_SRV/PSPSet('00014158001')",
            "uri": "http://hvw-sapdev01.oms-sap.omnisys.de:8000/sap/opu/odata/SAP/Z_TBRKNPRO_SEARCH_DL_SRV/PSPSet('00014158001')",
            "type": "Z_TBRKNPRO_SEARCH_DL_SRV.PSP"
          },
          "Psp": "00014158001"
        },
        {
          "__metadata": {
            "id": "http://hvw-sapdev01.oms-sap.omnisys.de:8000/sap/opu/odata/SAP/Z_TBRKNPRO_SEARCH_DL_SRV/PSPSet('00030173001')",
            "uri": "http://hvw-sapdev01.oms-sap.omnisys.de:8000/sap/opu/odata/SAP/Z_TBRKNPRO_SEARCH_DL_SRV/PSPSet('00030173001')",
            "type": "Z_TBRKNPRO_SEARCH_DL_SRV.PSP"
          },
          "Psp": "00030173001"
        }
      ]
    }
  }
  </code></pre>
  
  <p>And DLSet:</p>
  
  <pre><code>{
    "DLSet": {
      "results": [
        {
          "__metadata": {
            "id": "http://hvw-sapdev01.oms-sap.omnisys.de:8000/sap/opu/odata/SAP/Z_TBRKNPRO_SEARCH_DL_SRV/SEARCH_DLSet(9168)",
            "uri": "http://hvw-sapdev01.oms-sap.omnisys.de:8000/sap/opu/odata/SAP/Z_TBRKNPRO_SEARCH_DL_SRV/SEARCH_DLSet(9168)",
            "type": "Z_TBRKNPRO_SEARCH_DL_SRV.SEARCH_DL"
          },
          "Abrechungsstatus": "",
          "Contractnr": "",
          "DatumHigh": "",
          "DatumLow": "",
          "Login": "",
          "Mandant": "",
          "Mitarbeiter": "",
          "Name": "",
          "Psp": "",
          "Client": "001",
          "Id": 9168,
          "Impdate": "",
          "Ldatum": "20130705",
          "Lperiode": "",
          "PersNr": "49056462",
          "PersName": "J",
          "PersGrade": "",
          "LocalGradeKey": "",
          "LocalGradeDesc": "",
          "PersKstN": "",
          "PersKstB": "",
          "AufKstNr": "",
          "AufKstBe": "",
          "AufNr": "",
          "AufBez": "",
          "Bemerkung": "",
          "DebitorId": "0000037503",
          "DebitorBez": "G",
          "ProdCodeNr": "T130",
          "ProdCodeBez": "Allg. Steuerberatung von Unternehmen",
          "IndustCodeNr": "99999",
          "IndustCodeBez": "H",
          "ArbZ": "5.0000000000000000E-01",
          "ScaleRate": "280.0000",
          "MarketRate": "280.0000",
          "ScaleValue": "0.0000",
          "CostRate": "0.0000",
          "CukyCostRt": "",
          "Fakturiert": "",
          "FakeLdate": "",
          "Confidential": "",
          "KontraktNr": "5000059735",
          "PrctrHead": "",
          "Honorar": "140.0000",
          "Kosten": "140.0000",
          "SatzNeu": "280.0000",
          "HonorarNeu": "140.0000"
        },
        {
          "__metadata": {}
        }
      ]
    }
  }
  </code></pre>