Question
· Jun 13, 2022

How to transform json to SDA and write to a file?

I have a proprietary JSON and a need to transform to SDA and save to a sda file.

How to transform json to SDA and write to a file?

Thanks

Product version: IRIS 2021.2
Discussion (1)1
Log in or sign up to continue

Hello Yuri,

I think you have two strategies:

1) Use Dynamic Objects to traverse your JSON Arrays in loops and extract your fields by saving them directly to your SDA Properties. This is what I had done a couple of years ago when I had to get data from a product that could only output JSON. Once you have your final SDA you can then write it to a file.

2) Since you are on IRIS, you can use %JSON.Adaptor. I had not used it but I think it works just like %XML.Adaptor. If your class inherits from %JSON.Adaptor, it is basically aware of your JSON structure. You can then create Cache Objects as your data model for your incoming JSON and simply copy their Properties to SDA Properties.

I hope this helps. 

Vitaly