amazon-ion / ion-python

A Python implementation of Amazon Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
261 stars 51 forks source link

How to Convert IonPyDict into Native Python dict? #364

Open MacHu-GWU opened 3 months ago

MacHu-GWU commented 3 months ago

IonPyDict is the returned type of loads() method. However, a lot of data library like pandas, polars works with native python library only, is there a convenient way to convert all value of IonPyDict into native Python value?

rmarrowstone commented 3 months ago

For context, this appears to be a follow-up from https://github.com/amazon-ion/ion-python/issues/362

My suggestion there was to use the IonPyValueModel.STRUCT_AS_STD_DICT which should result in Ion Structs deserializing to IonPyStdDict objects (which inherit from dict).

If that solution doesn't work for you, please help me understand why not and what you need instead.