AnsweredAssumed Answered

How to create the hierarchical Jason structure using the hierarchy data set?

Question asked by x0262352261604 on Jun 30, 2017
Latest reply on Jul 26, 2017 by Adam Arrowsmith

Hi,

I have a scenario where I have the result set from ORACLE  DB with Hierarchical query.

The resultset is like

appID, appDESC, level.

23      ABC            1

28      XYZ            2

58      PQR           2

67      ADFG         3

56     DFET          1

78     RDWF         2

90    HRFD           3

63    YRCS           3

80     UFDE         2

When I create the json file it is coming out flat

[

{ "appId" = 23, "appDESC"="ABC","level" = 1}

{ "appId" = 28, "appDESC"="XYZ","level" = 2}

...

....

]

 

My requirement is to create the json as

{ "appId" = 23, "appDESC"="ABC","level" = 1}

     { "appId" = 28, "appDESC"="XYZ","level" = 2}

     { "appId" = 58, "appDESC"="PQR","level" = 2} 

           { "appId" = 67, "appDESC"="ADFG","level" = 3} 

{ "appId" = 56, "appDESC"="DFET","level" = 1}

      { "appId" = 78, "appDESC"="RDWF","level" = 2}

            { "appId" = 90, "appDESC"="HRFD","level" = 3} 

            { "appId" = 63, "appDESC"="YRCS","level" = 3} 

      { "appId" = 80, "appDESC"="UFDE","level" = 2}

 

I can create the json structure, but my question how we can move based on the level to different object in hierarchy. If someone have solution it be helpful. 

 

Outcomes