<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: removed...... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497009#M4682952</link>
    <description>&lt;P&gt;Yes i mean that.&lt;/P&gt;&lt;P&gt;Can i do it dynamically ? Because i dont want to write ScarrToSfight or ScarrToSpfli or etc. This loop should determine this "results" and remove it automatically. I can have several nested arrays in my progress. My main purpose is automatically remove this "results" tags.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Nov 2021 18:10:18 GMT</pubDate>
    <dc:creator>former_member489109</dc:creator>
    <dc:date>2021-11-22T18:10:18Z</dc:date>
    <item>
      <title>removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaq-p/12497002</link>
      <description>&lt;P&gt;removed&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 14:09:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaq-p/12497002</guid>
      <dc:creator>former_member489109</dc:creator>
      <dc:date>2021-11-22T14:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497003#M4682946</link>
      <description>&lt;P&gt;Hi Burak,&lt;/P&gt;&lt;P&gt;what is about this approach.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;this.getModel().read("/MyEntity",{&lt;BR /&gt;  success(oData){ &lt;BR /&gt;    var _oPerson = oData.result;
    var _nameFirst = _oPerson.FirstName;
   ...
  }
});&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Nov 2021 14:30:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497003#M4682946</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2021-11-22T14:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497004#M4682947</link>
      <description>&lt;P&gt;Hi Thorsten,&lt;/P&gt;&lt;P&gt;Thank you for your answer.I know how to reach this elements inside &lt;A rel="nofollow" href="http://json.My" target="_blank"&gt;json. My&lt;/A&gt; problem is not &lt;A rel="nofollow" href="http://that.My" target="_blank"&gt;that. My&lt;/A&gt; purpose is deleting the "results" tags from the returned odata json by dynamically. So I want the converted json does not have any result tag at the end&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 14:59:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497004#M4682947</guid>
      <dc:creator>former_member489109</dc:creator>
      <dc:date>2021-11-22T14:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497005#M4682948</link>
      <description>&lt;P&gt;Hi Burak,&lt;/P&gt;&lt;P&gt;you can create a new Json String with&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
oData.result.Education = oData.result.Education.result;
JSON.stringify(oData.result)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Nov 2021 15:04:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497005#M4682948</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2021-11-22T15:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497006#M4682949</link>
      <description>&lt;P&gt;why you are doing that? what is the real problem?&lt;/P&gt;&lt;P&gt;if you delete it, how can it be json format???&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 16:26:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497006#M4682949</guid>
      <dc:creator>junwu</dc:creator>
      <dc:date>2021-11-22T16:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497007#M4682950</link>
      <description>&lt;P&gt;Firstly you can see my odata picture then;&lt;/P&gt;&lt;P&gt;If you try this like deep insert you will get error.Because deep insert works without "results" tags.&lt;/P&gt;&lt;P&gt; var oEntry = oData.results[0];&lt;/P&gt;&lt;P&gt; var oModel = that.getView().getModel();&lt;/P&gt;&lt;P&gt; oModel.create("/ScarrSet", oEntry, {&lt;/P&gt;&lt;P&gt; method: "POST",&lt;/P&gt;&lt;P&gt; success: function(oData, oResponse) {&lt;/P&gt;&lt;P&gt; console.log("success");&lt;/P&gt;&lt;P&gt; },&lt;/P&gt;&lt;P&gt; error: function(oError, oResponse) {&lt;/P&gt;&lt;P&gt; console.log("error");&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt; });&lt;/P&gt;&lt;P&gt;But if you remove "results" tags its work fine&lt;/P&gt;&lt;P&gt; var oEntry = oData.results[0];&lt;/P&gt;&lt;P&gt; oEntry.ScarrToSpfli = oEntry.ScarrToSpfli.results;&lt;/P&gt;&lt;P&gt; oEntry.ScarrToSflight = oEntry.ScarrToSflight.results;&lt;/P&gt;&lt;P&gt; var oModel = that.getView().getModel();&lt;/P&gt;&lt;P&gt; oModel.create("/ScarrSet", oEntry, {&lt;/P&gt;&lt;P&gt; method: "POST",&lt;/P&gt;&lt;P&gt; success: function(oData, oResponse) {&lt;/P&gt;&lt;P&gt; console.log("success");&lt;/P&gt;&lt;P&gt; },&lt;/P&gt;&lt;P&gt; error: function(oError, oResponse) {&lt;/P&gt;&lt;P&gt; console.log("error");&lt;/P&gt;&lt;P&gt; }&lt;/P&gt;&lt;P&gt; });&lt;/P&gt;&lt;P&gt; I know i can change data before create operation.I dont prefer this. I just want to remove all "result" tags in the returned odata json.&lt;/P&gt;&lt;P&gt;In addition, it provides convenience in data binding.&lt;/P&gt;&lt;P&gt;You can use it as ("test&amp;gt;/data") instead of ("test&amp;gt;/data/results").&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 17:36:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497007#M4682950</guid>
      <dc:creator>former_member489109</dc:creator>
      <dc:date>2021-11-22T17:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497008#M4682951</link>
      <description>&lt;P&gt;Hi Burak,&lt;/P&gt;&lt;P&gt;you mean something like the JS Array function map?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;oData.result = oData.result.map(&lt;BR /&gt;    function(p){ &lt;BR /&gt;      p.ScarrtoSflight =  p.ScarrtoSflight.results; &lt;BR /&gt;      return p;&lt;BR /&gt;    }&lt;BR /&gt;);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Or the for Each Function&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;oData.result.forEach(&lt;BR /&gt;    function(p){ &lt;BR /&gt;      p.ScarrtoSflight =  p.ScarrtoSflight.results; &lt;BR /&gt;    }&lt;BR /&gt;);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Nov 2021 17:48:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497008#M4682951</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2021-11-22T17:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497009#M4682952</link>
      <description>&lt;P&gt;Yes i mean that.&lt;/P&gt;&lt;P&gt;Can i do it dynamically ? Because i dont want to write ScarrToSfight or ScarrToSpfli or etc. This loop should determine this "results" and remove it automatically. I can have several nested arrays in my progress. My main purpose is automatically remove this "results" tags.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Nov 2021 18:10:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497009#M4682952</guid>
      <dc:creator>former_member489109</dc:creator>
      <dc:date>2021-11-22T18:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497010#M4682953</link>
      <description>&lt;P&gt;Hi Burak,&lt;/P&gt;&lt;P&gt;I gave it a go and came up with this rather ugly solution. It works for a maximum of two nested result-arrays inside the top-level result array. I guess you know the kind of response you will get so you will you can decide if two is enough or if you need more levels. You could more levels in a similar fashion as I did or spent some time on it and come up with some kind of recursive function.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;if (a.result) var b = a.result

for (i = 0; i &amp;lt; b.length; i++) { 
  Object.keys(b[i]).forEach(key =&amp;gt; { 
    if (b[i][key].result) b[i][key] = b[i][key].result 

    Object.keys(b[i][key]).forEach(key2 =&amp;gt; {
      if (b[i][key][key2] &amp;amp;&amp;amp; b[i][key][key2].result) b[i][key] = b[i][key][key2].result
    })
  })
}

console.log(b)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Nov 2021 08:48:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497010#M4682953</guid>
      <dc:creator>nicoschoenteich</dc:creator>
      <dc:date>2021-11-23T08:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: removed......</title>
      <link>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497011#M4682954</link>
      <description>&lt;P&gt;Yess!!&lt;/P&gt;&lt;P&gt; I also found a similar solution. Thank you very much!&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;		_edit: function(oData) {
			var aData = oData.results;
			var aKeys = [];
			for (var i = 0; i &amp;lt; aData.length; i++) {
				aKeys = [];
				aKeys = Object.keys(aData[i]);

				for (var j = 0; j &amp;lt; aKeys.length; j++) {

					if (aData[i][aKeys[j]] instanceof Object &amp;amp;&amp;amp; aData[i][aKeys[j]].hasOwnProperty("results")) {
						aData[i][aKeys[j]] = aData[i][aKeys[j]]["results"];
					}
				}
			}
			return aData;
		},&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Nov 2021 10:49:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/removed/qaa-p/12497011#M4682954</guid>
      <dc:creator>former_member489109</dc:creator>
      <dc:date>2021-11-23T10:49:25Z</dc:date>
    </item>
  </channel>
</rss>

