cancel
Showing results for 
Search instead for 
Did you mean: 

How to return deep json object in odata api

hod222
Discoverer
0 Kudos
218
  • SAP Managed Tags:

I need create an api that will return structure that one of is fields is table base on structure that one of his fields is table too.

implementing $expended entity is too much complicated

what i do now is return a string

and in the front end i do json parse ( and it is not comfort because i need run over all boolean values and convert 'x' to true... )

can i return json object without instriction of flat entity?

hod222
Discoverer
0 Kudos

Thank u but I use v2,

The object i want to get in get api  is like this

Data : { date: '13.08.2024',

        Booleanfields :true,

       Table1:[ { itemType :1,

                       Table2 :[{ name:'TTT', 

                                       Cost:34 }....], //end of table 2

                       Table3:[ { name:'ee',

                                     Table4:[ { age:4,

                                                           Booleanfield : false }....] // end of table4

                                     }...] // end of table 3

                   }...] // end of table1

      } // end of data

I not shure if it possiable to use get expanded entity hear and if to be honest i dont realy want because i need to do few get apis that return diffrent but similar data like above ( implementing $expended entity is not easy )

There is simple way to do that in v2? Is it possible in rest api?

View Entire Topic
RalfHandl
Product and Topic Expert
Product and Topic Expert
0 Kudos

There is no way to do that in OData V2, other than what you have already discovered: tunnel your deep structure in a JSON string.

OData V2 does not support collection-valued properties, which is one of the many reasons why we moved forward to OData V4 ten years ago.

Maybe you want to switch to V4.