<?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>topic Re: Manipulating incoming JSON with Simple Transformations in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-incoming-json-with-simple-transformations/m-p/346970#M6598</link>
    <description>&lt;P&gt;Thanks for your answer, Mr. Keller. &lt;/P&gt;&lt;P&gt;I looked at the example and I think I could use it with some adjustments. The problem is that the JSON I get is pretty big, and completely rebuilding it just for the little part of my customVariables is taking way too long. &lt;/P&gt;&lt;P&gt;ST are rather fast with a lot of data, so I chose them. Is there a possibility for ST to fetch the attributes of sub-objects? I tried something like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;tt:loop ref="$visit.customVariables" name="custvar"&amp;gt;
  &amp;lt;object&amp;gt;
    &amp;lt;tt:group&amp;gt;
      &amp;lt;tt:cond frq="?"&amp;gt;
        &amp;lt;object name="1"&amp;gt;
          &amp;lt;str name="customVariableName1"&amp;gt;
            &amp;lt;tt:value ref="$custvar.CUSTOMVARIABLENAME"/&amp;gt;
          &amp;lt;/str&amp;gt;
          &amp;lt;str name="customVariableValue1"&amp;gt;
            &amp;lt;tt:value ref="$custvar.CUSTOMVARIABLEVALUE"/&amp;gt;
          &amp;lt;/str&amp;gt;
        &amp;lt;/object&amp;gt;
       ...
      &amp;lt;/tt:cond&amp;gt;
    &amp;lt;/tt:group&amp;gt;
  &amp;lt;/object&amp;gt;
&amp;lt;/tt:loop&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but it didn't work as I hoped it would. &lt;/P&gt;&lt;P&gt;What I will try is using a sub transformation with customVariables as the root node and some magic with parameters, maybe this does help. &lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2017 10:06:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2017-02-08T10:06:11Z</dc:date>
    <item>
      <title>Manipulating incoming JSON with Simple Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-incoming-json-with-simple-transformations/m-p/346968#M6596</link>
      <description>&lt;P&gt;Hey eyeryone, &lt;/P&gt;
  &lt;P&gt;I've got the task to save an incoming JSON-File to an ABAP structure. So far so good, I managed to get most of my fields mapped with Simple Transformations. &lt;/P&gt;
  &lt;P&gt;One problem remains: Within my JSON I get a list of objects like &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;{
  "1":{  
         "customVariableName1":"xxx1",
         "customVariableValue1":"yyy1"
      },
  "2":{  
         "customVariableName2":"xxx2",
         "customVariableValue2":"yyy2"
      }, ... 
}&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I want to save them as a internal table in my structure without creating ddic-structure for every little sub-structure. So my result in the ABAP structure should look like&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;[identifier] &amp;lt;--optional | customVariableName | customVariableValue  
-------------------------|--------------------|---------------------
1                        | xxx1               | yyy1
2                        | xxx2               | yyy2
...&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Is there any way to access the values of the sub-objects in JSON and match them to my preferred way of saving? &lt;/P&gt;
  &lt;P&gt;I tried many things and read much about different tags in ST, but without success... Maybe some of you know something.&lt;/P&gt;
  &lt;P&gt;Thanks in advance and kind regards&lt;/P&gt;
  &lt;P&gt;PS: I should add a note that I will always deserialize files with this ST, but never serialize ABAP data back to JSON. So "One-Way-Solutions" are possible as well. &lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 07:22:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-incoming-json-with-simple-transformations/m-p/346968#M6596</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-02-08T07:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating incoming JSON with Simple Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-incoming-json-with-simple-transformations/m-p/346969#M6597</link>
      <description>&lt;P&gt;Would it be an option to parse your JSON with methods of the sXML library? See &lt;A href="http://help.sap.com/abapdocu_751/en/index.htm?file=abenabap_json_oo_reader_abexa.htm"&gt;simple example&lt;/A&gt;. Maybe you can enhance it for your needs.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 07:32:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-incoming-json-with-simple-transformations/m-p/346969#M6597</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-02-08T07:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Manipulating incoming JSON with Simple Transformations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-incoming-json-with-simple-transformations/m-p/346970#M6598</link>
      <description>&lt;P&gt;Thanks for your answer, Mr. Keller. &lt;/P&gt;&lt;P&gt;I looked at the example and I think I could use it with some adjustments. The problem is that the JSON I get is pretty big, and completely rebuilding it just for the little part of my customVariables is taking way too long. &lt;/P&gt;&lt;P&gt;ST are rather fast with a lot of data, so I chose them. Is there a possibility for ST to fetch the attributes of sub-objects? I tried something like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;tt:loop ref="$visit.customVariables" name="custvar"&amp;gt;
  &amp;lt;object&amp;gt;
    &amp;lt;tt:group&amp;gt;
      &amp;lt;tt:cond frq="?"&amp;gt;
        &amp;lt;object name="1"&amp;gt;
          &amp;lt;str name="customVariableName1"&amp;gt;
            &amp;lt;tt:value ref="$custvar.CUSTOMVARIABLENAME"/&amp;gt;
          &amp;lt;/str&amp;gt;
          &amp;lt;str name="customVariableValue1"&amp;gt;
            &amp;lt;tt:value ref="$custvar.CUSTOMVARIABLEVALUE"/&amp;gt;
          &amp;lt;/str&amp;gt;
        &amp;lt;/object&amp;gt;
       ...
      &amp;lt;/tt:cond&amp;gt;
    &amp;lt;/tt:group&amp;gt;
  &amp;lt;/object&amp;gt;
&amp;lt;/tt:loop&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;but it didn't work as I hoped it would. &lt;/P&gt;&lt;P&gt;What I will try is using a sub transformation with customVariables as the root node and some magic with parameters, maybe this does help. &lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2017 10:06:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/manipulating-incoming-json-with-simple-transformations/m-p/346970#M6598</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-02-08T10:06:11Z</dc:date>
    </item>
  </channel>
</rss>

