From bfab8758f7f0fc1f14092aef723ca425e3af3659 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 22 Feb 2021 15:15:21 -0800 Subject: [PATCH] In parsing abbreviations JSON, ignore top-level fields... besides "default". (E.g. "info" which is used in zotero's defaults.) Partially addresses #57. --- src/Citeproc/Types.hs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Citeproc/Types.hs b/src/Citeproc/Types.hs index 649017b..8291e3d 100644 --- a/src/Citeproc/Types.hs +++ b/src/Citeproc/Types.hs @@ -1608,12 +1608,8 @@ newtype Abbreviations = deriving (Show, Eq, Ord) instance FromJSON Abbreviations where - parseJSON (Object v) = - Abbreviations <$> - (parseJSON (Object v) >>= maybe - (fail "abbreviations lacks a default key") - return . M.lookup ("default" :: Text)) - parseJSON _ = fail "Could not read abbreviations" + parseJSON = withObject "Abbreviations" $ \v -> + Abbreviations <$> v .: "default" instance ToJSON Abbreviations where toJSON (Abbreviations m) =