Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2812

Convert the JSON to an ABAP structure

$
0
0

Hi All,

 

I'm trying to convert a JSON String into ABAP structure using  'deserialize' method of class 'cl_trex_json_deserializer'

 

Here is the JSON String which I want to convert into ABAP structure

 

json_response = {"token":"sometokenstring","token_type":"sometokentypestring","key":"somekeystring"}

 

and below is the code

 

types: begin of ty_stru,

           token type string,

           token_type type string,

           key     type string,

          end of ty_stru.

 

         data: out  TYPE ty_stru,

                  lr_json_deserializer TYPE REF TO cl_trex_json_deserializer.


CREATE OBJECT lr_json_deserializer.

 

lr_json_deserializer->deserialize( EXPORTING json = json_response IMPORTING abap = out).

 

when I run this code I'm getting CX_TREX_SERIALIZATION exception

 

Could you help me fix this

 

Thank you

Nagaraju


Viewing all articles
Browse latest Browse all 2812

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>