astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- Astropy Core Package Utilities (`astropy.utils`) »
- JsonCustomEncoder

# JsonCustomEncoder

class `astropy.utils.misc.``JsonCustomEncoder`(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, encoding='utf-8', default=None)

  Bases: `json.encoder.JSONEncoder`

  Support for data types that JSON default encoder does not do.

  This includes:

  > - Numpy array or number
  > - Complex number
  > - Set
  > - Bytes (Python 3)

  Examples

      >>> import json
      >>> import numpy as np
      >>> from astropy.utils.misc import JsonCustomEncoder
      >>> json.dumps(np.arange(3), cls=JsonCustomEncoder)
      '[0, 1, 2]'

  Methods Summary

  `default`(obj) |

  Methods Documentation

  `default`(obj)