diff --git a/dustmaps/json_serializers.py b/dustmaps/json_serializers.py index 2a0a0cd..4a5574c 100644 --- a/dustmaps/json_serializers.py +++ b/dustmaps/json_serializers.py @@ -267,7 +267,11 @@ def serialize_skycoord(o): except AttributeError: # Very old versions of astropy do not use `representation_type` representation_type = o.representation - representation = representation_type.get_name() + # .name was introduced in astropy 7.1 (replacing the deprecated .get_name()) + if hasattr(representation_type, 'name'): + representation = representation_type.name + else: + representation = representation_type.get_name() frame = o.frame.name r = o.represent_as('spherical')