Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts to convert objects to yaml/json ready formats #5165

Open
profxj opened this issue Jul 9, 2016 · 1 comment
Open

Scripts to convert objects to yaml/json ready formats #5165

profxj opened this issue Jul 9, 2016 · 1 comment

Comments

@profxj
Copy link
Contributor

profxj commented Jul 9, 2016

I propose to add two scripts to astropy.utils.data (or a neighboring module)
that convert Python objects into YAML or JSON ready formats. This code
already exists (with tests and documentation) as:

linetools.utils.jsonify
https://github.com/linetools/linetools/blob/master/linetools/utils.py

and

desiutils.io.yamilfy
https://github.com/desihub/desiutil/blob/master/py/desiutil/io.py

I feel this has general use within the astronomical community (quite
possible that similar routines already exist).

@pllim
Copy link
Member

pllim commented Oct 30, 2019

Fast forward to 2019, we already have JSON support for a number of objects:

class JsonCustomEncoder(json.JSONEncoder):
"""Support for data types that JSON default encoder
does not do.
This includes:
* Numpy array or number
* Complex number
* Set
* Bytes
* astropy.UnitBase
* astropy.Quantity

Is there something in particular that is still missing that you think would benefit the astronomy Python community?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants