How to convert amazon ion to json data using java

663 Views Asked by At

I'm working with amazon ion data, stored in file. I need to convert it to Json data. Is there any libraries available in Java? Or any another type of data format close to Json?

Task I'm doing

I have fetched the data from dynamoDB, which generated the .txt file having this type of data, which is ion format (separated by new line).

{group:{s:"accounts"},rId:{s:"Ada_Invoice"},item:{s:"System Issue"},environments:{ss:["Env:Ada/Alpha"]},category:{s:"Publish"},type:{s:"Ada"},groups:{ss:["ada-admins"]}}

I have to consolidate this data around environment. I want to convert the ion to JSONObject, so that i can perform .get() around keys.

P.S. - newbie to java

1

There are 1 best solutions below

0
On

One way is to use Jackson Ion library to convert ion data to POJO, then conver the POJO to JSON.

Check more details in the answer here - How to convert Amazon QLDB IonStruct to Json in java?