diff --git a/src/Data/Argonaut/Decode/Decoders.purs b/src/Data/Argonaut/Decode/Decoders.purs index cf3c0ca..ff06669 100644 --- a/src/Data/Argonaut/Decode/Decoders.purs +++ b/src/Data/Argonaut/Decode/Decoders.purs @@ -66,7 +66,7 @@ decodeEither decodeEither decoderA decoderB json = lmap (Named "Either") $ decodeJObject json >>= \obj -> do tag <- note (AtKey "tag" MissingValue) $ FO.lookup "tag" obj - val <- note (AtKey "value" MissingValue) $ FO.lookup "value" obj + val <- note (AtKey "contents" MissingValue) $ FO.lookup "contents" obj case toString tag of Just "Right" -> Right <$> decoderB val Just "Left" -> Left <$> decoderA val diff --git a/src/Data/Argonaut/Encode/Encoders.purs b/src/Data/Argonaut/Encode/Encoders.purs index aad0596..0837468 100644 --- a/src/Data/Argonaut/Encode/Encoders.purs +++ b/src/Data/Argonaut/Encode/Encoders.purs @@ -42,7 +42,7 @@ encodeEither encoderA encoderB = either (obj encoderA "Left") (obj encoderB "Rig obj encoder tag x = fromObject $ FO.fromFoldable - $ Tuple "tag" (fromString tag) : Tuple "value" (encoder x) : Nil + $ Tuple "tag" (fromString tag) : Tuple "contents" (encoder x) : Nil encodeUnit :: Unit -> Json encodeUnit = const jsonNull