<?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: problem with Serialization JSON with children in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-serialization-json-with-children/m-p/12288027#M1989206</link>
    <description>&lt;P&gt;To make it valid, I replaced the line with:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      lo_child  TYPE REF TO lcl_test.&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 09 Nov 2020 04:44:16 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2020-11-09T04:44:16Z</dc:date>
    <item>
      <title>problem with Serialization JSON with children</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-serialization-json-with-children/m-p/12288026#M1989205</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;
  &lt;P&gt;I need to deserialize a JSON that containts children or hierarchical/recursive data, to do this I am follow example from SAP WIKI: &lt;A href="https://wiki.scn.sap.com/wiki/display/Snippets/One+more+ABAP+to+JSON+Serializer+and+Deserializer" target="test_blank"&gt;https://wiki.scn.sap.com/wiki/display/Snippets/One+more+ABAP+to+JSON+Serializer+and+Deserializer&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;In that link there is a example called: &lt;STRONG&gt;Serialization/deserialization of hierarchical/recursive data &lt;/STRONG&gt;&lt;/P&gt;
  &lt;P&gt;I am triying to do that example but I dont understand this line:&lt;/P&gt;
  &lt;P&gt;lo_child LIKE lo_data.&lt;/P&gt;
  &lt;P&gt;I know its a variable declaration but object lo_data not exists on the example, and its not on dicionary data types, could anyone can explain me?&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;TYPES:
  BEGIN OF ts_node,
    id        TYPE i,
    children  TYPE STANDARD TABLE OF REF TO data WITH DEFAULT KEY,
  END OF ts_node.

DATA: lv_exp    TYPE string,
      lv_act    TYPE string,
      ls_data   TYPE ts_node,
      lr_data   LIKE REF TO ls_data.

ls_data-id = 1.

CREATE DATA lr_data.
lr_data-&amp;gt;id = 2.
APPEND lr_data TO ls_data-children.

lv_exp = '{"ID":1,"CHILDREN":[{"ID":2,"CHILDREN":[]}]}'.
lv_act = /ui2/cl_json=&amp;gt;serialize( data = ls_data ).
cl_aunit_assert=&amp;gt;assert_equals( act = lv_act exp = lv_exp msg = 'Serialization of recursive data structure fails' ).


CLASS lcl_test DEFINITION FINAL.
  PUBLIC SECTION.
    DATA: id TYPE i.
    DATA: children TYPE STANDARD TABLE OF REF TO lcl_test.
ENDCLASS.


DATA: lo_act    TYPE REF TO lcl_test,
      lo_exp    TYPE REF TO lcl_test,
      lv_json   TYPE string,
      lo_child  LIKE lo_data.

CREATE OBJECT lo_exp.

lo_exp -&amp;gt;id = 1.

CREATE OBJECT lo_child.
lo_child-&amp;gt;id = 2.
APPEND lo_child TO lo_exp-&amp;gt;children.

lv_json = /ui2/cl_json=&amp;gt;serialize( data = lo_exp ).
ui2/cl_json=&amp;gt;deserialize( EXPORTING json = lv_json CHANGING data =  lo_act ).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 04:02:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-serialization-json-with-children/m-p/12288026#M1989205</guid>
      <dc:creator>former_member553037</dc:creator>
      <dc:date>2020-11-09T04:02:36Z</dc:date>
    </item>
    <item>
      <title>Re: problem with Serialization JSON with children</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-serialization-json-with-children/m-p/12288027#M1989206</link>
      <description>&lt;P&gt;To make it valid, I replaced the line with:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;      lo_child  TYPE REF TO lcl_test.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 04:44:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-serialization-json-with-children/m-p/12288027#M1989206</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-11-09T04:44:16Z</dc:date>
    </item>
  </channel>
</rss>

