diff --git a/lib/GEODE/Metadata/Types.hs b/lib/GEODE/Metadata/Types.hs index caeabec1d47337552410060734e24535d30ea310..881168ab4151b7cb4799af160d1b204e8b72a3cb 100644 --- a/lib/GEODE/Metadata/Types.hs +++ b/lib/GEODE/Metadata/Types.hs @@ -35,9 +35,10 @@ class ToJSONObject a where toJSONObject :: a -> Object toJSONPairs :: a -> Series -instance {-# OVERLAPPABLE #-} ToJSONObject a => ToJSON a where - toJSON = Object . toJSONObject - toEncoding = pairs . toJSONPairs +instance {-# OVERLAPPABLE #-} (ToJSONObject a, ToJSONObject b) => + ToJSON (a @ b) where + toJSON (a :@: b) = Object $ toJSONObject a `Object.union` toJSONObject b + toEncoding (a :@: b) = pairs $ toJSONPairs a <> toJSONPairs b instance {-# OVERLAPPABLE #-} (FromJSON a, FromJSON b) => FromJSON (a @ b) where parseJSON o = (:@:) <$> parseJSON o <*> parseJSON o